I’m working on an offline html5 app which does a lot of DOM manipulation by building html strings within javascript functions.
e.g.
var html='';
html+='<div class="main">';
html+= '<img src="Content/images/literature.png" />';
html+='</div>';
... etc.
$('#main-onoffline-container').html(html);
Has anyone got any suggestions on how to manage the html snippets better so that they can treated more like resources that can be brought easily into particular divs on the page?
You can use underscore or jQuery templates. Take a look at the below links these might help you.
http://scriptble.com/2011/01/underscore-js-templates/
http://api.jquery.com/jQuery.template/