jQuery extend $.fn and calling method syntax

Posted by MBax on Stack Overflow See other posts from Stack Overflow or by MBax
Published on 2011-01-10T14:33:32Z Indexed on 2011/01/10 14:53 UTC
Read the original article Hit count: 107

Filed under:

I understand that you call a method like this when you are extending $.fn.

( $ == jQuery )

//$("div").myMethod();

$.fn.extend({
   myMethod: function(){...}
});

And like this when you extend the jQuery Object:

//$.myMethod2();

$.extend({
    myMethod2: function(){...}
});

But I don't quite understand what the $() is doing here:

$().functionName({
  something: 'something'
}).myMethod();

Does it have to do with the fact the method is being called including the function name?

Thanks in advance and hope this makes sense.

© Stack Overflow or respective owner

Related posts about jQuery