The core functionality of jQuery contains a plethora of interesting features to investigate. jQuery allows you to manipulate HTML elements, navigate the document, add event listeners (for example, when you click on an element), and perform AJAX requests and effects.
Don’t worry if you don’t know what jQuery is or if some of these terms are unfamiliar to you; we’ll go over some of these concepts further down.
You’ll want to create an app.js as this is where we’re going to put our jQuery code.
The jQuery Function
Now that you’ve included jQuery in your project, you’ll need to know how to use jQuery to select HTML elements. jQuery is a function that can be passed a number of arguments, the most common of which is a CSS selector string. These selectors are used to select HTML elements on which to apply behaviour. If you wanted to select all paragraphs on a page, you’d type the following into a new script tag or, in our case, app. js:
Because p is the CSS selector used to select all paragraphs, I passed the string "p" to the jQuery method. If I wanted to select all elements with the class error, I would type:
While you can use the jQuery method in its entirety to select HTML elements, there is a more common shorthand way to call the jQuery method, which is $. Our previous two examples can be written as $("p") and $("p") (".error"). Throughout the rest of this post, we'll use the abbreviation $.
In this jquery tutorial you’ve seen how easy it is to do effects, DOM transversal, events and manipulation in jQuery
This press release was published on Supremearticle.com
Permanent link to this press release here