YouTip LogoYouTip

Misc Callbacks Fire

# jQuery callbacks.fire() Method [![Image 3: jQuery Misc Methods](#)jQuery Misc Methods](#) ## Example Invoke all callbacks with specified arguments $(function(){// A simple function to be added to the list var foo = function(value){alert("foo:" + value); }; var callbacks = $.Callbacks(); // Add function "foo" to the list callbacks.add(foo); // Invoke all callbacks in the list with arguments callbacks.fire("hello"); // Output: "foo: hello"callbacks.fire("world"); // Output: "foo: world // Add another function to the list var bar = function(value){alert("bar:" + value); }; // Add this function to the list callbacks.add(bar); // Invoke all callbacks in the list with arguments callbacks.fire("hello again"); // Output:// "foo: hello again"// "bar: hello again"}) [Try it Β»](#) * * * ## Definition and Usage The callbacks.fire() function is used to invoke all callbacks with specified arguments. This method returns a callback object to the callback list it is bound to. * * * ## Syntax callbacks.fire( arguments ) | Parameter | Description | | :--- | :--- | | _arguments_ | Any type The arguments or argument list to pass back to the callback list | * * jQuery Misc Methods](#)
← Misc Callbacks FirewithDocker Install Apache β†’