JQuery, toggling a class on dynamic content
<p>I need to add a class to a  within a block of generated content coming from JSON. I believe it's barking on the toggleClass because the HTML is actually not generated yet. I figure I probably need to use .on() or .live() in some fashion.</p>

<p>I am not receiving an error, it's just not adding the class. Again, because the table content is being built dynamically I believe.</p>

<p>Here's the relevant code.</p>

<pre><code>// The data variable is a block of JSON
for(i=1; i &lt; data.length; i++){
 foo += '&lt;tr id="'+data[i][2]+'"&gt;test&lt;/tr&gt;';

 // Here's where I am trying to add the class, but it is not working. We check to see if a value in our JSON is true, if so - we change the class.
if(data[i][1]){
 $("#"+data[i][2]).toggleClass("newClass"); // finds the ID by unique name
}

}
</code></pre>
