jQuery mousedown() Method Last Updated : 11 Jul, 2025 Suggest changes Share Like Article Like Report The jQuery mousedown() method is an inbuilt method that works when the left mouse button is pressed down over the selected element. Syntax: $(selector).mousedown(function)Parameters: This function accepts a single parameter function which is optional. It is used to specify the function to run when the mousedown event is called. Example 1: This example illustrates the mousedown() method in jQuery. HTML <!DOCTYPE html> <html> <head> <title>The mousedown Method</title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <!-- jQuery code to show the working of this method --> <script> $(document).ready(function () { $("div").mousedown(function () { alert("Mouse left key was pressed"); }); }); </script> <style> div { width: 200px; height: 40px; font-weight: bold; border: 2px solid green; padding: 20px; } </style> </head> <body> <!-- click on this button and pop up will appear--> <div> Welcome to GeeksforGeeks! </div> </body> </html> Output: Example 2: In this example, we will change the background color by using the mousedown() method. HTML <!DOCTYPE html> <html> <head> <title>The mousedown Method</title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <!-- jQuery code to show the working of this method --> <script> $(document).ready(function () { $("div").mousedown(function () { $("div").css( "background-color", "green"); }); }); </script> <style> div { width: 200px; height: 40px; font-weight: bold; border: 2px solid black; padding: 20px; } </style> </head> <body> <!-- click on this button to change the background color--> <div> Welcome to GeeksforGeeks! </div> </body> </html> Output: Related Articles: jQuery | on() with ExamplesjQuery | first() with Examples K kundankumarjha Follow Article Tags : Web Technologies JQuery jQuery-Methods Explore jQuery Tutorial 7 min read Getting Started with jQuery 4 min read jQuery Introduction 7 min read jQuery Syntax 2 min read jQuery CDN 4 min read jQuery SelectorsJQuery Selectors 5 min read jQuery * Selector 1 min read jQuery #id Selector 1 min read jQuery .class Selector 1 min read jQuery EventsjQuery Events 4 min read jQuery bind() Method 2 min read jQuery blur() Method 1 min read jQuery change() Method 2 min read jQuery EffectsjQuery animate() Method 2 min read jQuery clearQueue() Method 2 min read jQuery delay() Method 2 min read jQuery HTML/CSSjQuery addClass() Method 2 min read jQuery after() Method 1 min read jQuery append() Method 2 min read jQuery TraversingjQuery | Traversing 4 min read jQuery add() method 1 min read jQuery addBack() Method 2 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like