Possible Duplicate:
what is the meaning of "$" sign in javascript
If Jquery is just external javascript code, then how does it use the dollar sign? Wouldn't that be adding new syntax?
Possible Duplicate:
what is the meaning of "$" sign in javascript
If Jquery is just external javascript code, then how does it use the dollar sign? Wouldn't that be adding new syntax?
$
is just a normal variable. You can do var $ = 42;
.
jQuery - and any other javascript framework, simply encapsulate existing functionality in different utility functions. Most platforms endeavor to cover different browser implementations.
So, jQuery's dollar-sign operator is simply a function in which javascript functionality is encapsulated. It is, in essence, an alias for document.getElementById
, but it also covers getting by class name or tag name.
As for adding new syntax, in short: no, it does not. The look and organization of code written in a framework may be different, but at the core you're still writing javascript, you're just using a set of functions provided by the library instead of using the set of functions in javascript core.
var $ = function () {
// do something here
}