Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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{} 
like image 717
anthonypliu Avatar asked Jun 22 '10 04:06

anthonypliu


People also ask

What is FN JS?

Fn is a lightweight Docker-based serverless functions platform you can run on your laptop, server, or cloud.

What does FN stand for in coding?

The Fn key, short form for function, is a modifier key on many keyboards, especially on laptops, used in a compact layout to combine keys which are usually kept separate.

What does the $() mean in jQuery?

In jQuery, the $ sign is just an alias to jQuery() , then an alias for a function. This page reports: Basic syntax is: $(selector).action() A dollar sign to define jQuery.

What is FN extend?

fn. extend() method extends the jQuery prototype ( $. fn ) object to provide new methods that can be chained to the jQuery() function.


2 Answers

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

like image 136
Chad Levy Avatar answered Sep 30 '22 00:09

Chad Levy


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

like image 24
Warren Rumak Avatar answered Sep 30 '22 02:09

Warren Rumak