Understanding the $ Symbol


The dollar symbol ($) is the most important part of jQuery.

It is used to access jQuery functions and select HTML elements.

In jQuery, the $ symbol is actually a shortcut name for the jQuery function.

Both $ and jQuery mean the same thing.

Here, the $ symbol selects paragraph elements and applies the hide method.

This is the most common way jQuery code is written.

This code works exactly the same as using the $ symbol.

The $ symbol is simply a shorter version of the jQuery function.

The $ symbol is also used to access special jQuery functions like document ready.

It ensures that jQuery runs only after the page is fully loaded.

Important Notes About $ Symbol:

  • $ is an alias for jQuery
  • Both $ and jQuery work the same
  • $ makes code shorter and cleaner
  • Avoid conflicts when using multiple libraries