March 2018
Intermediate to advanced
592 pages
13h 44m
English
Before we dive into index.js let's take a quick moment to talk about how we can use jQuery to select elements. jQuery, which is accessible via the jQuery variable, takes your selector as its argument. Then, we're going to add a string and we can select our elements. For example, if we want to select all the paragraph tags on the screen we would type p in the quotes:
jQuery('p');
These are really similar to CSS selectors if you're familiar with them, and as shown, we've selected our paragraph tag.
I could also go ahead and select all of the div inside my program, or I could select elements by ID or class, and that's what we're going to do. In order to select an element by ID we first start with the pound sign ...