jQuery Event Handling

0 comments

Cloning elements and Binding and Rebinding events

Use .clone(true) to copy event handlers as well. This article describes in more detail and also talks about rebinding and unbinding events manually when doing DOM manipulation other than cloning.

http://www.learningjquery.com/2008/05/working-with-events-part-2

 

It is important to note this breaking change - which will probably break some of our projects:

Beware! As of jQuery 1.4.2, binding the same handler to the same element multiple times will cause it to execute more than once. This differs from previous versions of jQuery as well as the DOM 2 Events spec (which normally ignores duplicate event handlers).

 

 


Comments


Leave a Comment