Easy Tutorial
❮ Eff Fadeout Sel Parent Descendant ❯

jQuery callbacks.empty() Method

jQuery Miscellaneous Methods

Example

Remove all callbacks from the list.

$(function () { 
    // A simple function to be added to the list
    var foo = function( value1, value2 ) {
        alert( "foo: " + value1 + "," + value2 );
    }
    // Another function to be added to the list
    var bar = function( value1, value2 ){
        alert( "bar: " + value1 + "," + value2 );
    }    
    var callbacks = $.Callbacks();    
    // Add the two functions
    callbacks.add( foo );
    callbacks.add( bar );    
    // Empty the callback list
    callbacks.empty();
    // Confirm if all callbacks are removed
    alert( callbacks.has( foo ) );
    // false
    alert( callbacks.has( bar ) );
    // false
})

Definition and Usage

The callbacks.empty() function is used to remove all callbacks from the list.

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


Syntax

This method does not accept any parameters.


jQuery Miscellaneous Methods

❮ Eff Fadeout Sel Parent Descendant ❯