Possible Duplicate:
What is the $ in jQuery?
We know that $ is an alias of jQuery, while using jQuery javascript framework.
But internally what $ is ?
I mean whether it is an object, function or other thing?
Possible Duplicate:
What is the $ in jQuery?
We know that $ is an alias of jQuery, while using jQuery javascript framework.
But internally what $ is ?
I mean whether it is an object, function or other thing?
$ is a function object in jQuery. It can take a number of different types of parameters or methods. That's why you will see things like:
$("#content")
In that use, it's just a function - identical to:
jQuery("#content")
In this example, it returns an object that contains both the collection of DOM items matching the passed in CSS string and has a whole bunch of methods that let you operate on that collection of items it returned such as:
var html = $("#content").html()
to get the innerHTML of that DOM object.
It is usually used like a function $(params)
, but can also has methods as an object $.get()
.
But, most of all $
is just a symbol for a function object that also has methods. It could be called foo
or anything else so it's not anything unusual in Javascript.
$ is just and alias. Its same as jQuery Object. That is its reference to jQuery Object.
$ is an object, just like jQuery is. Besides, all objects in javascript are functions and all functions are objects.
$
is a variable in exactly the same way that jQuery
is a variable. And its value is a function.