What is the meaning of symbol $ in jQuery?

jquery function
jquery tutorial
jquery name selector
jquery dollar sign
jquery find
how jquery is structured
what is this in jquery
jquery class selector

What does the $ sign in jQuery stand for?

The jQuery object :)

From the jQuery documentation:

By default, jQuery uses "$" as a shortcut for "jQuery"

So, using $("#id") or jQuery("#id") is the same.

What is the meaning of symbol $ in jQuery?, It refers to immediate parent child relationship in selector, read more: jQuery parent > child Selector[^]. With respect to javaScript, $ symbol is just a valid identifier. Consider the following code snippet. $ = 5; console.log ($); The above code snippet would just print number 5 in the console. So, from the perspective of javascript (as a language), $ symbol is just an identifier. jQuery is a JavaScript library – particularly useful for DOM manipulation. jQuery uses this identifier to refer to the jQuery function, which is overloaded in many ways – including for getting the element by its id.

Strange but true, you can use "$" as a function name in JavaScript. It is shorthand for jQuery(). Which you can use if you want. jQuery can be ran in compatibility mode if another library is using the $ already. Just use jQuery.noConflict(). $ is pretty commonly used as a selector function in JS.

In jQuery the $ function does much more than select things though.

  1. You can pass it a selector to get a collection of matching elements from the DOM.
  2. You can pass it a function to run when the document is ready (similar to body.onload() but better).
  3. You can pass it a string of HTML to turn into a DOM element which you can then inject into the document.
  4. You can pass it a DOM element or elements that you want to wrap with the jQuery object.

Here is the documentation: https://api.jquery.com/jQuery/

What does the ">"symbol in jquery means, A $ sign to define/access jQuery; A (selector) to "query (or find)" HTML elements; A jQuery action() to be performed on the element(s). Examples: $(this).hide()  1) '$' is starting symbol of jquery, in every sentence '$' symbol is used. 2)in javascript '$'sign is valid identifier, which is used as an alis for jquery. 3)also '$ ' sign is used as primary base object , in prototype, jquery and most javascript libaries. 4)basic syntax is: $ (selector) to query html element.

It is syntactic sugar. It is not specific only to jQuery; other libraries use it as well. You can look for a full-details article about the use of dollar sign in JavaScript here.

jQuery Syntax, symbol in jQuery (and in javascript). Before discussing about the functionality of '​$' in jQuery, let us take a look at what it( $ sign) means with  Strange but true, you can use “$” as a function name in JavaScript. It is shorthand for jQuery (). Which you can use if you want. jQuery can be ran in compatibility mode if another library is using the $ already. Just use jQuery.noConflict (). $ is pretty commonly used as a selector function in JS.

As said in other answers $ is a shortcut to the jQuery function.

Some JavaScript libraries uses $ too (example: prototype). To avoid conflict with those other libraries jQuery provides jQuery.noConflict() function. Calling this function the control of the $ variable goes back to the other library that first implemented it. Doing this to use jQuery you can't do this $('div.someClass') anymore, instead jQuery('div.someClass').

Alternatively can do this:

jQuery.noConflict();

jQuery.ready(function($) {
   // use $ for jQuery
}

//use $ for the other library

When writing plugins to avoid problems with the usage of noConflict you can pass 'jQuery' to a function:

function($) {

//use $ writing your plugin

}(jQuery)

$ symbol in jQuery (and in javascript), The purpose of the origin of jQuery was to Separate JavaScript and HTML. In JavaScript we have Why do we use a dollar symbol ($) before variables in PHP​? $ sign is just a valid javascript identifier which is used as an alias for jQuery. Prototype, jQuery, and most javascript libraries use the $ as the primary base object (or function). Most of them also have a way to relinquish the $ so that it can be used with another library that uses it. In that case you use jQuery instead of $.

$ is simply a function called jQuery. It is how you access all of the functionality in the jQuery lib.

You can find it here: http://docs.jquery.com/%24

What does the dollar sign ($) mean in jQuery?, jQuery - Selectors - The jQuery library harnesses the power of Cascading Style Sheets (CSS) selectors to let us quickly and easily access elements or groups of​  $ sign is used as an alias to Jquery. instead of using jquery.hide,jquery.show every where we can use the alias $ ($.hide) Since we are using this word lot of times. 'Jquery' will not be a convenient way so we are using the alias $. If we want to change it we can change it by noConflict method var Sample=$.noConflict()

jQuery - Selectors, Define a plain object. var foo = { foo: "bar", hello: If not, the string is interpreted as a selector expression, as explained above. But if the string appears to be an  A $ sign to define/access jQuery. A ( selector) to "query (or find)" HTML elements. A jQuery action () to be performed on the element (s) Examples: $ (this).hide () - hides the current element. $ ("p").hide () - hides all <p> elements. $ (".test").hide () - hides all elements with class="test".

jQuery(), jQuery.type( Symbol() ) === "symbol" // as of jQuery 1.9; jQuery.type( Object( Symbol() ) ) === "symbol" // as of jQuery 1.12; jQuery.type( /test/ ) === "regexp". +1 for pointing out the xref between jQuery and CSS - I'm sure the jQuery authors chose these selectors intentionally to map to the existing standard for CSS. – GalacticCowboy May 18 '10 at 19:35 jQuery actually uses sizzle which is a css selector engine in javascript: sizzlejs.com – ordnungswidrig May 18 '10 at 20:17

jQuery.type(), The definitions of important web development concepts such as API, DOM, and To access a selector, use the jQuery symbol $ , followed by  Answer: Dollar Sign is nothing but it's an alias for JQuery. Take a look at below jQuery code $(document).ready(function(){ }); Over here $ sign can be replaced with "jQuery" keyword.

Comments
  • you could make the title a wee bit more descriptive, instead of just looking like a couple of category tags
  • it's a fine question for jquery noobs such as myself. I cobbled together some jquery pages by cutting and pasting from the internet, and it was the first question I had about what I was doing.
  • Hi, @Andrea i don't know whether i'm asking correct question or not, i'm new to jQuery. Can we replace that $ with any other symbol? and if possible, how?
  • @Hulk you can use noConflit() to replace it .
  • You know, this REALLY should be the right answer for this question... I can't believe all those joke-y answers got all the up-votes.
  • Agree with reedvoid's comments. It is a reflection on the state of affairs in Javascript programming. That said, the more precise link now that answers the question is api.jquery.com/jQuery
  • If $ is a function, then how are we calling the method noConflict() on it? That would have been possible if $ was an object, not function.
  • @dk49 In JavaScript, functions can have properties too. Try this: function Person() {}; Person.city = 'Missoula'; console.log(Person.city)
  • For more evidence try typeof $ which will ouput "Function". ;)
  • Well, I liked the term syntactic sugar. Thank for that :)
  • How is this an answer? From this I learned that the '$' sign in jQuery stands for "syntactic sugar". And the linked article talks at length about the hows and the why, without answering it concisely. The next answer by @andrea does the job in three words.
  • I think the OP wanted to know why is that $ symbol chosen to represent the library, not on what really means, which is kinda obvious and documented
  • that link doesnt work anymore, the one that you said explains in detail $
  • @user734028 I changed the link to a cached one, please check now