Easy Tutorial
❮ Misc Fn Extend Misc Merge ❯

jQuery callbacks.fireWith() Method

jQuery Miscellaneous Methods

Example

Accesses all callbacks in the list with the given context "window" and array of arguments.

$(function () { 
    // A simple function to be added to the list
    var log = function( value1, value2 ) {
        alert( "Received: " + value1 + "," + value2 );
    };

    var callbacks = $.Callbacks();
    // Add the function to the list
    callbacks.add( log );
    // Call the callback list with the context "window"
    // and an array of arguments
    callbacks.fireWith( window, ["foo","bar"]);
    // Output: "Received: foo, bar"
})

Definition and Usage

The callbacks.fireWith() function accesses all callbacks in the list with the given context and arguments.


Syntax

Parameter Description
context A reference to the context to be triggered in the callback list
args An argument or list of arguments to be passed to the callback list

jQuery Miscellaneous Methods

❮ Misc Fn Extend Misc Merge ❯