Book Image

Mastering JavaScript Promises

Book Image

Mastering JavaScript Promises

Overview of this book

Table of Contents (16 chapters)
Mastering JavaScript Promises
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Behind the scenes – how does jQuery work?


jQuery is based on a simple line of write less, do more; within a few lines of jQuery code, you will be able to achieve more tasks than conventional ways of writing code. jQuery has made many tasks easy to conclude in a short time span. It also brings neatness and readability in code, which earlier, was rare in JavaScript.

After the arrival of jQuery, things started to change dramatically for JavaScript. Many new implementations started to come on the screen with much more mature approaches, but the place jQuery has gained was unmatched then and still is.

Having said this, let's come back to our topic: how does jQuery work behind the scenes?

It all rotates around the $ sign. The jQuery library provides the jQuery (); function, which allows you select elements just like CSS selectors. For example:

var itemsList = jQuery query("ul");

Or:

var itemsList = $("ul");

In the preceding line, the $ sign is the representation of jQuery. In JavaScript, the variable...