Is there a general best practice for creating somewhat complex HTML elements in jQuery? I\'ve tried a few different ways.
First I tried using createElement and chaining
John Resig (creator of jQuery) suggested using this templating method back in 2008. It's actually got some pretty cool features:
then retrieving it using...
var results = document.getElementById("results");
results.innerHTML = tmpl("item_tmpl", dataObject);
See here for full details:
http://ejohn.org/blog/javascript-micro-templating/