Adding HTML then having it function...
Ok, the title might not be a very good title, but I'll try to explain a little better INSIDE the post
Ok, so here is my example jQuery
-
$(document).ready(function(){
$('#holder').html('<a href="#" id="foo">Hey!</div>');
$('#foo').click(function(){
alert('Working!');
});
});
Ok, so when the page loads, the div with the id of
holder adds a link inside itself (with an id of
foo). But when I click on the link, the alert() doesn't show up. Of course this is because the link was added after the page loaded, but how can I accomplish something like this?
Thanks!