What I'm trying to do is to create a table pager control using jQuery. It contains lots of links and spans. I've managed to do this with plain string concatenation, but I can't believe that jQuery can't make this more elegant. I can't use jTemplates here since the generation has quite a bit of procedural logic.
Question: is there a way to create an array of HTML elements with jQuery and append them to some container?
Thanks.
$('First Element').add($('Second Element')).appendTo($('body'))
String concatenation (or Array.join) is fine, as long as you make it pretty ;)
var structure = [
'<div id="something">',
'<span>Hello!</span>',
'</div>'
];
$(structure.join('')).appendTo(container);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With