I need some help with jQuery theory. Why can't I select an element that has been loaded through an AJAX call? For instance, I'll load table.php that renders like this:
<table> <tr> <td>1</td> <td><a id="foo">Foo</a></td> </tr> </table> I make the ajax call to it like this: $.post( "table.php", { }, function(str) { $("tablebox").html(str); } ); But then, when I try to bind and event to one of the elements from the AJAX call, I get nothing: $('#foo').click(function() { alert('You clicked Foo'); }); I've tried binding the events from within the $.post callback, but still nothing. Can anyone explain why this is the case, and if there are any options I'm overlooking? Thanks!