title: jQuery add rows dynamically - maximum 10
body: <p>I am adding table rows dynamically with unique input/label names. However, I only want for a user to be able to add max 6 rows.</p>
  
  <p>I tried using lastid &lt; 7 but it doesn't work. Any suggestions?</p>
  
  <pre><code>function addTableRow(jQtable) {
     var lastId = jQtable.find("tr:last td:first input").attr("id");
     var newId = parseInt(lastId);
  
      var row = $('&lt;tr /&gt;');
  
      for (var i = 0; i &lt;= 2; i++) {
          var thisId = newId + 1;
          var cell = $('&lt;td /&gt;');
          var label = $('&lt;label for="' + thisId + '"&gt;' + thisId + '&lt;/label&gt;');
          var input = $('&lt;input type="text" name="' + thisId + '" id="' + thisId + '" /&gt;');
          cell.append(label, input);
          row.append(cell);
      }
      jQtable.append(row);
      }
  
     $('#addRow').click(function() {
     addTableRow($('#mans'));
    });
  </code></pre>