jQuery callbacks.disable()Method

jQuery 杂项方法jQuery Miscellaneous Methods

Example

Disable callbacks in the callback list

$(function () { //A simple function that will be added to the list var foo = function( value ) { alert( value ); }; var callbacks = $.Callbacks(); //Add the above function to the callback list callbacks.add( foo ); //Pass arguments to call all functions in the callback list callbacks.fire( "foo" ); //Output: foo //Disable callbacks callbacks.disable(); //Try using "foobar" as a parameter callbacks.fire( "foobar" ); //foobar will not be output })

Try it »

Definition and Usage

The callbacks.disable() function is used to disable callbacks in the callback list.

Tip:This method returns a callback object to the callback list it is bound to.


Syntax

This method accepts no parameters.

callbacks.disable()


jQuery 杂项方法jQuery Miscellaneous Methods

Other Extensions