jquery - difference between $.functionName and $.fn.FunctionName

Posted by Russell on Stack Overflow See other posts from Stack Overflow or by Russell
Published on 2010-05-16T23:55:06Z Indexed on 2010/05/17 0:00 UTC
Read the original article Hit count: 208

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about functions