Javascript examples for jQuery Method and Property:on
Attach a click event to a <p> element with on()
<!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 om*/ }); }); </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>