Applying jQuery function to dynamically added item
<p>My question is basically <a href="http://stackoverflow.com/questions/1240184/applying-jquery-function-to-dynamically-added-item">the same as this one</a> (which never got properly answered).</p>

<p>How can I use a jQuery function on an item I add dynamically?</p>

<p>Specifically, I want to use the <a href="http://tablesorter.com/docs/" rel="nofollow">jquery tablesorter plugin</a> on a table that I load on the page dynamically, after the user does something. </p>

<p>Here's my code:</p>

<pre><code> results_html += "&lt;table id='results' class='tablesorter&gt;&lt;thead&gt;"; 
 [My table contents go here, ommitted for this question]
 results_html += "&lt;/tbody&gt;&lt;/table&gt;";
 $('#book_results').html(results_html);
 $("#results").tablesorter(); 
</code></pre>

<p>There are no JS errors on the page, but the tablesorter functions aren't being applied. What can I do?</p>

<p>Thanks!</p>
