I am using jQuery to attach a function to my click event for an entire class. For example:
$(".clickDiv").click(function(){
$(this).hide();
});
On my client-side javascript, I create more .clickDiv instances dynamically.
Do I need to call the $(".clickDiv).click(function...) again, or will the new instances automatically have that function bound to the click event?
Yes you do, unless you use a
delegate eventlike this:
ondocs:Just because too much people here suggested you should use
live,liveis deprecated since version1.7byonand was replaced in version1.4.3bydelegate