Skip to content
Related Articles

Related Articles

Improve Article

jQuery | mousedown() with Examples

  • Last Updated : 13 Feb, 2019

The mousedown() method is an inbuilt method in jQuery which works when the left mouse button is pressed down over the selected element.


Parameters: This function accepts single parameter function which is optional. It is used to specify the function to run when the mousedown event is called.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

Return Value: This method returns the selected element with the change.

Below example illustrates the mousedown() method in jQuery:


<!DOCTYPE html>
        <title>The mousedown Method</title>
        <script src=
        <!-- jQuery code to show the working of this method -->
            $(document).ready(function() {
                $("div").mousedown(function() {
                    alert("Mouse left key was pressed");
            div {
                width: 200px;
                height: 40px;
                font-weight: bold;
                border: 2px solid green;
                padding: 20px;
        <!-- click on this button and pop up will appear-->
        <div>Welcome to GeeksforGeeks!</div>

Before click on the paragraph element:

After click on the paragraph element:

Related Articles:

My Personal Notes arrow_drop_up
Recommended Articles
Page :