Skip to content Skip to sidebar Skip to footer

How To Create A Custom Jquery Function With Brackets And Parameters

I know that my question needs a little more clarification, so let me explain: When I visited the jquery api documentation for $.fn.extend, I was personally blown away by how easy i

Solution 1:

If you want to use:

check({timer:1000,redo:4000,displayAt:'someID'});

with jquery.fn.extend your function would be declared like so:

check: function(options) {
    // Get the timer valuevar timerValue = options.timer;
    // Get the redo valuevar redoValue = options.redo;
    ...
}

Standalone, it would look like this:

functioncheck(options) {
    // Get the timer valuevar timerValue = options.timer;
    // Get the redo valuevar redoValue = options.redo;
    ...
}

Post a Comment for "How To Create A Custom Jquery Function With Brackets And Parameters"