Javascript examples for jQuery:Mouse Event
Toggle Div by id on paragraph click
<html> <head> <title>toggle div on p click</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.js"></script> <script type="text/javascript"> $(window).load(function(){//w w w. j a va 2 s.co m $("#p1").on("click", function() { $("#d1").toggle(); }); }); </script> </head> <body> <p id="p1"> click this to toggle div </p> <div id="d1"> div content </div> </body> </html>