how to unbind all event using jquery

zjm1126 picture zjm1126 · Aug 25, 2010 · Viewed 80.9k times · Source

i can use this code to remove click event,

$('p').unbind('click')

but , has some method to remove all event ?

has a method named unbindAll in jquery ?

thanks

Answer

Nick Craver picture Nick Craver · Aug 25, 2010

You can call .unbind() without parameters to do this:

$('p').unbind();

From the docs:

In the simplest case, with no arguments, .unbind() removes all handlers attached to the elements.