title: How to count dynamically added table rows with jQuery?
body: <p>How can I count the table rows that is added dynamically with jQuery?</p>
  
  <p>I have tried with <code>$('#mytbody').children().length;</code> but it doesn't work with rows that are added dynamically.</p>
  
  <p>Here is my code, also <a href="http://jsfiddle.net/H8sBr/" rel="nofollow">runnable in JsFiddle</a></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="jquery-1.6.2.min.js"&gt;
  &lt;script&gt;
  $(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);
      });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &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;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>