Using jQuery’s click event
So how does it work you ask? Simple. In our jQuery ready block, we have a selector for the element with a class “clickable” (the element the click event is fired on), and our jQuery click function. Inside our click function we are simply alerting the word “hello”.
So when the user clicks on the element with the class “clickable”, an alert box will appear with the message hello. Simple stuff.