title: my script only working from console
body: <p>I have a script that I put inside my html doc.</p>
  
  <p>when I load the html page the script is not working,but when I put the script inside the console then the script is working an making the effect I want on the html doc.</p>
  
  <p>here is the script,what i'm doing wrong?</p>
  
  <pre><code>var maxRows = 10;
  $('.table').each(function() {
  var cTable = $(this);
  var cRows = cTable.find('tr:gt(0)');
  var cRowCount = cRows.size();
  
  if (cRowCount &lt; maxRows) {
      return;
  }
  
  cRows.each(function(i) {
      $(this).find('td:first').text(function(j, val) {
         return (i + 1) + " - " + val;
      }); 
  });
  
  cRows.filter(':gt(' + (maxRows - 1) + ')').hide();
  
  
  var cPrev = cTable.siblings('.prev');
  var cNext = cTable.siblings('.next');
  
  cPrev.addClass('disabled');
  
  cPrev.click(function() {
      var cFirstVisible = cRows.index(cRows.filter(':visible'));
  
      if (cPrev.hasClass('disabled')) {
          return false;
      }
  
      cRows.hide();
      if (cFirstVisible - maxRows - 1 &gt; 0) {
          cRows.filter(':lt(' + cFirstVisible + '):gt(' + (cFirstVisible - maxRows - 1) + ')').show();
      } else {
          cRows.filter(':lt(' + cFirstVisible + ')').show();
      }
  
      if (cFirstVisible - maxRows &lt;= 0) {
          cPrev.addClass('disabled');
      }
  
      cNext.removeClass('disabled');
  
      return false;
  });
  
  cNext.click(function() {
      var cFirstVisible = cRows.index(cRows.filter(':visible'));
  
      if (cNext.hasClass('disabled')) {
          return false;
      }
  
      cRows.hide();
      cRows.filter(':lt(' + (cFirstVisible +2 * maxRows) + '):gt(' + (cFirstVisible + maxRows - 1) + ')').show();
  
      if (cFirstVisible + 2 * maxRows &gt;= cRows.size()) {
          cNext.addClass('disabled');
      }
  
      cPrev.removeClass('disabled');
  
      return false;
  });
  </code></pre>
  
  <p>});</p>