jquery - difference between $.functionName and $.fn.FunctionName
- by Russell
In jQuery, I have seen both the following ways of defining a jQuery function:
$.fn.CustomAlert = function() {
alert('boo!');
};
$.CustomAlert = function() {
alert('boo!');
};
I understand that they are attached to the jQuery object (or $), but what is the difference between the two? When should I use one or the other?
Thanks.