Moved message to body append to end of function

If the message contains html / js code, event handlers are bound to the elements as the dialog is already displayed.