Moved appending of message to body to the end of function

If the provided message contains js code with event handlers, those handlers are bound to the elements as the dialog is already displayed. Before the handlers were ignored, cause the dialog was not in dom / visible.


I'm not matching all your contribution guidelines, as I don't have the matching dev environment.
But for this minor change you might be able to include it without it.