jQuery callbacks.remove() method
Example
Use callbacks.remove() to remove a callback from a callback list
$
(
function
(
)
{
//
A simple test function
var
foo
=
function
(
value
)
{
alert
(
"
foo:
"
value
)
;
}
;
var
callbacks
= $.
Callbacks
(
)
;
//
Add the test function foo to the list
callbacks
.
add
(
foo
)
;
//
Call all callbacks with the given arguments
callbacks
.
fire
(
"
hello
"
)
;
//
Output "foo: hello"
//
Lock the callback list
callbacks
.
remove
(
foo
)
;
//
Test the state of the callback list
callbacks
.
fire
(
"
world
"
)
;
//
No output, because there is no "foo" callback function in the list
}
)
Try it »
Definition and Usage
The callbacks.remove() function is used to remove a callback or a collection of callbacks from a callback list.
This method returns a callbacks object to the callback list it is bound to
Syntax
callbacks.remove( callbacks )
| Parameters | Description |
|---|---|
| callbacks | Function, Array type: A function or an array of functions to be removed from the callback list |
jQuery Miscellaneous Methods