anthonypliu
anthonypliu

Reputation: 12437

In jQuery, what does $.fn. mean?

In jQuery, what does $.fn. mean? I looked this up on google but couldn't find any concrete examples.

$.fn.something = function{}

Upvotes: 73

Views: 36851

Answers (3)

Chad Levy
Chad Levy

Reputation: 10140

It allows you to extend jQuery with your own functions.

For example,

$.fn.something = function{}

will allow you to use

$("#element").something()

$.fn is also synonymous with jQuery.fn which might make your Google searches easier.

See jQuery Plugins/Authoring

Upvotes: 135

Warren Rumak
Warren Rumak

Reputation: 3864

This has been covered in some detail here:

Why jQuery do this: jQuery.fn.init.prototype = jQuery.fn?

But the short of it is that $.fn is an alias for $jQuery.prototype

Upvotes: 9

rahul
rahul

Reputation: 187050

See Plugins/Authoring

Upvotes: 7

Related Questions