Easy Tutorial
❮ Traversing Nextall Misc Callbacks Has ❯

jQuery callbacks.remove() Method

jQuery Miscellaneous Methods

Example

Using callbacks.remove() to remove a callback from the callback list

$(function () { 
    // Simple test function
    var foo = function( value ) {
        alert( "foo:" + value );
    };    
    var callbacks = $.Callbacks();    
    // Add test function foo to the list
    callbacks.add( foo );    
    // Call all callbacks with the argument "hello"
    callbacks.fire( "hello" );
    // Outputs "foo: hello"    
    // Lock the callback list
    callbacks.remove(foo);
    // Test the state of the callback list
    callbacks.fire( "world" );
    // No output, because the "foo" callback function is not in the list
})

Definition and Usage

The callbacks.remove() function is used to remove a callback or a collection of callbacks from the callback list.

This method returns a callback object to its bound callback list.


Syntax

Parameter Description
callbacks Function, Array type - A function or an array of functions to remove from the callback list

jQuery Miscellaneous Methods

❮ Traversing Nextall Misc Callbacks Has ❯