Applying JQuery effects to newly added elements
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4579117/jquery-live-vs-delegate">Jquery live() vs delegate()</a>  </p>
</blockquote>



<p>I am having some problems applying JQuery to functions that I add to the DOM after the page is loaded. I am using the following code to add new rows to a table body:</p>

<pre><code>  $("tbody").load("php/create_rows.php?" + $.param({ "type": "unique", "unit": "day", "interval": 2 }));
</code></pre>

<p>It works well. The rows get added, but Jquery functions that work on the rows in the table body do not affect the new rows. For example, mouseovers on rows are supposed to have a class applied to them that changes the background color:</p>

<pre><code>  $('tbody tr').hover(function() {
    $(this).find('td').addClass('hover');
  }, function() {
    $(this).find('td').removeClass('hover');
  });
</code></pre>

<p>It is not working, though. It works for code that already appears on the page, code that is not generated from Jquery.</p>
