Hello, in this jQuery video, I am going to show you how to detect a single mouse click on any element on your page. I've got three div elements right here, they don't have to be divs. They could be anything you want, you can use any type of selector you want. I'm just going to keep things simple. So to detect the click you, you obviously select your element or element on the div for the Select or depth. I'm going to do dot click.
So this is a single click, open bracket, the keyword function and this function is run. When this is clicked, if I were to reload and click it, nothing actually happened because well nothing's occurring in the function. If I were to do a console dot log, and it was a ad is clicked and already Note, and I click it, a div clicked on any of them. If I were to, let's say, a p tag now, I'll say, MP paragraph. And now if let's say I do it based on an ID, again, why the selector doesn't really matter. Epic ID.
And now, all I have to do is do something very similar. But instead of diff Aqua hash, epic ID, and I'll say, applicant, this one, I'm going to do an alert to learn. I'm going to say the idea. So that reload, just to confirm the other still working as intended. If I click this one, it pops this up. It doesn't do a console log because this function which is called is a separate piece of code to this.
This little event here you can use in conjunction with the binding and unbinding video, feel free to check that out as well. And that's it. It's really simple to do a single mouse click. If you have any questions, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.