From the course: jQuery Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Basic selectors

Basic selectors - jQuery Tutorial

From the course: jQuery Essential Training

Start my 1-month free trial

Basic selectors

- [Instructor] Basic jQuery selectors work by using a CSS-like syntax to select content from the page. Let's take a look at the syntax for each of these, and then we'll see how they work in our example exercise. To select all the elements in a page with a particular tagName, I simply pass the name of the tag to the jQuery function, which will select all of those elements. Similarly, I can pass an identifier of a specific element, and jQuery will select the element with that ID attribute that has the same name as the identifier. I can also select elements that have a particular class name by passing in the className proceeded by a period, just like you would define it in CSS. I can get a little more fancy by specifying tags that have a particular className by giving the name of the tag, followed by a period, and then the name of the class, just like in CSS. I can get even more fancy than that. I can say get me the element that has a specific tag type and has an ID and a class of the…

Contents