Hello, in this jQuery video, I am going to show you how to select an element based on its class. So this little selector is based on ID, but maybe add a class if we add a class of call it epic. I'll add one to this as well. And what I'm going to do is copy this and get rid of this. So in here, we'll just say epic. So to select a class, it's really simple.
You put dot, which indicates the selector is now a class and you put the name of it which is a believe it's a bit class. Save that, reload and populate hello world. Epic class is clicked. Second one, it triggers both events because it has idea of h w. And there's a click selector on an idea of h w. And it also has a class or epic class. And there's also a selector for clicking an element with the class. But if I click second div, nothing happened because it does not have a class or anything that is checking for it being clicked.
So if you want to select an element based on his class, which allow you to select, essentially a bunch of elements, they don't have to be the same type. They don't have to be or div or spanned or images, for example, but you can select multiple ones based on a certain event. You can do it using the class selector, and it's as simple as that. That's it. If you have any questions, feel free to drop me a message. And as usual, I look forward to seeing you in the next video.