title: Defining a HTML template to append using JQuery
body: <p>I have got an array which I am looping through. Every time a condition is true, I want to append a copy of the <code>HTML</code> code below to a container element with some values.</p>
  
  <p>Where can I put this HTML to re-use in a smart way?</p>
  
  <pre><code>&lt;a href="#" class="list-group-item"&gt;
      &lt;div class="image"&gt;
           &lt;img src="" /&gt;
      &lt;/div&gt;
      &lt;p class="list-group-item-text"&gt;&lt;/p&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>JQuery </p>
  
  <pre><code>$('.search').keyup(function() {
      $('.list-items').html(null);
  
      $.each(items, function(index) {
          // APPENDING CODE HERE
      });
  });
  </code></pre>