javascript - How to create a custom jquery function with brackets and parameters -


I know that my question requires a bit more explanation, so explain to me:

when I went to jquery api documentation for $ .fn.extend, I was personally blown by how easy it was to create a custom jquery function:

  $ ('input [type] = "Checkbox"] '). Check ();  

Link to:

But if you want to add functionality to the function like this (this means):

  Check ({Timer: 1000, Re: 4000, Display at: 'Some ID'}); // Filler parameter  

How would you do that, of course?

In addition, how you check ({...}); , which does not rely on any specific jquery selectors, but instead it has a regular function like this:

  displayRandomNumber ({min: 0, max: 100 , Display: 'someID'}); // no jquery selector in front of you  

Thanks for your help!

If you want to use:

  check ({timer : 1000, redo: 4000, display AT: 'some AID'});  

with Jquery.fn.extend will be declared as such:

  check: function (option) {// timer value var timer Get the value = Options.timer; // redo value get var redoValue = options.redo; ...}  

Standalone, it looks like this:

  function check (option) {// timer value var timervalue = get option timer ; // redo value get var redoValue = options.redo; ...}  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -