title: Running jQuery script after data loaded into table
body: <p>I have a table that is loaded with values like so:</p>
  
  <pre><code>@foreach (var i in model) 
  {
      &lt;tr&gt;
          &lt;td&gt;i.value&lt;/td&gt;
      &lt;tr&gt;
  }
  </code></pre>
  
  <p>I want to add a CSS class to each of the cells in the table depending on i.value. My plan was to run a jQuery script with some conditionals like this: </p>
  
  <pre><code>$(document).ready(function () {
      var cells = document.getElementsByTagName('td');
      for (var i = 0, len = cells.length; i &lt; len; i++) {
          var classToAdd = parseInt(cells[i].innerHTML, 10);
          if (classToAdd &gt; 10) {
              cells[i].className = 'newClass1';
          }
          ... More conditional logic ...
      }
  }
  </code></pre>
  
  <p>However, this is not working, and I believe it is because my script is running before the table is populated. If this is the case, how can I delay the script to run after the table is populated? Otherwise, please explain to me what I am doing wrong.</p>