Javascript examples for jQuery Method and Property:mousedown
Attach a function to the mousedown event:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("div").mousedown(function(){ $(this).after("<p>Mouse button pressed down.</p>"); });//w w w . ja va 2s .co m }); </script> </head> <body> <div style="color:red;">Press down the mouse button over this div element.</div> </body> </html>