Javascript examples for jQuery:Mouse Event
Use the on() method to attach a click event handler to all <p> elements.
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").on("click", function(){ $(this).hide();//from w w w .j a v a 2s .c o m }); }); </script> </head> <body> <p>If you click on me, I will disappear.</p> </body> </html>