So now we learned how to select elements, how to use the Chrome developer tools, selecting multiple
elements and make our own NodeJS web scraper.
Now it's time for me to introduce you to more CSS selectors inside of jQuery.
And if we move on to the next lesson here to lesson three, we can now see there's three elements.
H2 elements, but there is one that is a red color.
And the reason why it's red is because it has the ID inside the HTML element that is called red.
And we up here in the in the head element with the style, we have a red style with a color of red.
So that is how web developers select elements using CSS.
They can say that any H2 element should be a color of blue, or they can say This ID needs to have a
color of so and so.
That's how you style elements in HTML.
But we can also use this to our advantage when we want to select elements inside jQuery or our web scraper.
So we could say perhaps we only wanted the elements with this with this red color which has a red ID,
So you would click on this element, inspect it, and you could see, Hey.
This element has an ID of red and this is what I need to scrape.
So then we could go on to the console.
And make sure that you have jQuery injected in the site.
So we click on the extension here.
And then we can select an element with the ID of red.
So to make sure that you select an ID, you put the the hashtag sign or the number sign in front, and
then you have the ID here.
So this is the ID of red.
And then we can simply say dot text to see the text.
So now we have selected only the H2 element with this ID rather than before when we could when we were
selecting all of the H2 elements instead.
So if you want to be more precise, when you select elements, that is one way to do it is to see what
kind of ID does this element have.
And so to select IDs in jQuery, we put a hashtag sign in front and then put the ID.
Now let's move on to another CSS selector that exists, which is the class selector.