Estimated Length: 20min | Difficulty: Beginner
Before you start studying jQuery, you should have a basic knowledge of:
There are several ways to start using jQuery on your web site. You can:
There are two versions of jQuery available for downloading:
Both versions can be downloaded fromjQuery.com
<head> <script src="jquery-1.12.0.min.js"></script> </head>
If you don't want to download and host jQuery yourself, you can include it from a CDN (Content Delivery Network).
Both Google and Microsoft host CDN
Here is the script for the Google CDN:
The jQuery syntax is tailor made for selecting HTML elements and performing some action on the element(s).
Basic syntax is: $(selector).action()
The $ sign is used to define/access jQuery. The (selector) is used to "query" or find HTML elements. Finally, the jQuery action() is used to define what will be performed on the element(s).
All jQuery methods go inside a Document Ready Event.
//jQuery methods go here...
This is used to prevent any jQuery code from running before the document is finished loading (is ready).