Is it possible to remove all events attached to an element and its children
For jQuery 1.8 and later, use
$(element).find("*").addBack().off();
addBack()
adds the original list of elements from $(element)
back to the internal collection of elements held by the jQuery object (those returned by find("*")
). off()
removes all attached event handlers, including those using delegation.
If you just want children and not all descendants, use
$(element).children().addBack().off();
See the documentation:
For jQuery 1.7 and lower, use andSelf()
instead of addBack()
. For jQuery 1.6 and lower, use unbind()
and die()
instead of off()
. For example:
$(element).children().andSelf().unbind().die();