I hope this helps somebody, you can pass html to dialog directly, like this:
$("<p>Hello World!</p>").dialog();
so this way you don’t have to have a pre-builded div, you could use:
$("<div>My div content</div>").dialog();
EDIT: changed end tag to </div> instead of </p>