jQuery dollar sign

What’s with the jQuery dollar sign you see in every script?

If you have read or perused the information on the JavaScript page of Bootstrap you will have seen bit of jQuery code like:

The $ sign is an alias for jQuery. Actually the code should be written as:

 

But because you need to use the keyword ‘jquery’ a lot when you write scripts the $ alias is almost always used instead.

Because you have loaded the jQuery library and use scrip tags the browser understands that the $ sign stand for ‘jquery’.

When the browser read the $ sign it creates a so-called jQuery object. And this object will hold a collection of one or more elements. But I’ll  explain that in another post.

Add your comment