title: Count number of <tr> in table using jquery
body: <p>I just want to count the number of rows,</p>
  
  <pre><code>   &lt;button id="add"&gt;Add row&lt;/button&gt;
  &lt;table&gt;
      &lt;tbody id="mytbody"&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  Number of rows: &lt;span id="counter"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>$(function() {
      $('#add').bind('click', function() {
          $('#mytbody').after('&lt;tr&gt;&lt;td&gt;'+ new Date() +'&lt;/td&gt;&lt;/tr&gt;');
          var count = $('#mytbody').children().length;
          $('#counter').html(count);
      });
  });
  </code></pre>
  
  <p>I found this <a href="https://stackoverflow.com/questions/1149958/jquery-count-number-of-rows-in-a-table">jQuery: count number of rows in a table</a></p>
  
  <p>and this doesn't works <a href="http://jsfiddle.net/H8sBr/" rel="nofollow noreferrer">http://jsfiddle.net/H8sBr/</a></p>
  
  <p>I just don't get it working.
  help?</p>