YouTip LogoYouTip

Misc Callbacks Firewith

# jQuery callbacks.fireWith() Method [![Image 3: jQuery Misc Methods](#)jQuery Misc Methods](#) ## Example Invoke all callbacks in the list with the given context "window" and array arguments. $(function(){// A simple function to be added to the list var log = function(value1, value2){alert("Received: " + value1 + "," + value2); }; var callbacks = $.Callbacks(); // Add function to the list callbacks.add(log); // Invoke the callback list with context "window"// and an array of arguments callbacks.fireWith(window, ["foo","bar"]); // Output: "Received: foo, bar"}) [Try it yourself Β»](#) * * * ## Definition and Usage The callbacks.fireWith() function invokes all callbacks in the list with a given context and arguments. * * * ## Syntax callbacks.fireWith( [, args ] ) | Parameter | Description | | :--- | :--- | | _context_ | A reference to the context in which the callbacks in this list are invoked. | | _args_ | An argument or list of arguments to pass back to the callback list. | * * jQuery Misc Methods](#)
← Misc Callbacks LockMisc Callbacks Fire β†’