I have a page where I do:
$(document).ready(function(){
$("a.notifypop").bind('click', function(){
// Do stuff
return false
});
});
When I replace the content of the page I also replace the anchor that I have bound the click event to. The result is that the click event is no longer bound to the anchor – what to do in that situation? I HAVE to replace the anchor.
- Jacob
You can use
.delegateinstead..delegateis significantly cheaper then.liveAnd will bind to all all elements matching the selector.See the documentation on
.delegateSee Nick Craver’s Answer as to why
.delegateis better