描述:
Remove all event handlers from all paragraphs:
$("p").off()
Remove all delegated click handlers from all paragraphs:
$("p").off( "click", "**" )
Remove just one previously bound handler by passing it as the third argument:
var foo = function () {
// code to handle some kind of event
// ... now foo will be called when paragraphs are clicked ...
$("body").on("click", "p", foo);
// ... foo will no longer be called.
$("body").off("click", "p", foo);
Unbind all delegated event handlers by their namespace:
var validate = function () {
// code to validate form entries
// delegate events under the ".validator" namespace
$("form").on("click.validator", "button", validate);
$("form").on("keypress.validator", "input[type='text']", validate);
// remove event handlers in the ".validator" namespace
$("form").off(".validator");