This is probably a duplicate question, but I can’t find it.
I understand ” How to add a function to jQuery? ” – with the activation of that function being something like:
jQueury(selector).myFunction();
But jQuery also has some “core” functions that can be activated like:
jQuery.ajax(options);
If I want to add a function to jQuery that does not act on an element, like a logging function, how would I be able to achieve adding it to the “core” so that it can be activated like:
jQuery.log('message');
Use
$.extend( { functionName: function() { ... } } );.Or more simply:
$.functionName = function() { ... };.