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 values.
Where can I put this HTML to re-use in a smart way?
<a href="#" class="list-group-item">
<div class="image">
<img src="" />
</div>
<p class="list-group-item-text"></p>
</a>
JQuery
$('.search').keyup(function() {
$('.list-items').html(null);
$.each(items, function(index) {
// APPENDING CODE HERE
});
});