I have got an array which I am looping through. Every time a condition is true, I want to append a copy of the HTML
code below to a container element with some
Very good answer from DevWL about using the native HTML5 template element.
To contribute to this good question from the OP I would like to add on how to use this template
element using jQuery, for example:
$($('template').html()).insertAfter( $('#somewhere_else') );
The content of the template
is not html, but just treated as data, so you need to wrap the content into a jQuery object to then access jQuery's methods.