There are two methods to add HTML-code to the DOM and I don\'t know what is the best way to do it.
First method
The first way is the easy on
If I am going to re-use the div later in the code, I'll build it and put it in a var, usually with a $ prefix so I know it's a jQuery object. If it's a one-off thing I'll just do a:
div
var
$
$('body').append(the stuff)