title: Append a list item through loop in jQuery
body: <p>How do I append a new list item through loop in JQuery. Every time the user clicks the button, a new item gets appended showing the correct index.</p>
  
  <p>Here a sample of my code:</p>
  
  <pre><code>$('#append').click(function() {
      $('ul#myList &gt; li').each(function(i) {
          var content = "&lt;li&gt;" + "Item" + (1+i) + "&lt;/li&gt;";
          $(this).append(content);
      });
  });
  </code></pre>
  
  <p>Output should be like</p>
  
  <pre><code>Item 1
  Item 2
  Item 3
  and so on
  </code></pre>