Is there a way to 'pre-build' a snippet of HTML before adding it to the DOM?
For example:
$mysnippet.append("<h1>hello</h1>");
$mysnippet.append("<h1>world</h1>");
$("destination").append($mysnippet);
Yes pretty much exactly how you have done it
Some extension of this...
$('<div>').attr('id', 'yourid').addClass('yourclass').append().append()...
and then finally
.appendTo($("#parentid"));