Click Here

An event is an action performed by the user on any element of the HTML document.

Types of events:


Defining the function to perform when you click on a label <p>

$("p").click(function(){ // action goes here });

If we make doubleclick on a <p> item, hide the element.

$("p").dblclick(function(){    $(this).hide(); });

HTML code where the javascript is included:

<!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){   $("p").click(function(){      $(this).hide();   }); }); </script> </head> <body>   <p>If you click on me, I will disappear.</p>   <p>Click me away!</p>   <p>Click me too!</p> </body> </html>

Click Here