Skip to content

Instantly share code, notes, and snippets.

@suissa
Forked from netojoaobatista/jquery.unbindAll.js
Created April 25, 2012 21:51
Show Gist options
  • Save suissa/2493794 to your computer and use it in GitHub Desktop.
Save suissa/2493794 to your computer and use it in GitHub Desktop.
Remove todos os manipuladores de eventos que foram anexados aos elementos
/**
* Removes all previously-attached event handlers from the elements.
*/
$.fn.unbindAll = function() {
var events = $(this).data('events');
return this.each( function() {
var $this = $(this);
for ( var evt in events ) {
$this.unbind(evt);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment