In this article we will explain how to use mousedown() method in jquery or  how to attach mouse down event to a html element.


 jQuery mousedown() method adds an event handler function to an HTML element. This function is executed, when the left mouse button is pressed down, at the time while the mouse is over the HTML element.



jQuery mousedown() example

Let's take an example to see the mousedown() event in jQuery. In this example, when you left mouse button is pressed down on “h1” tag then “mouse down event triggered” text shown in “h2” tag.

 <!DOCTYPE html>
<html xmlns="">
    <title>Jquery Tutorials</title>
    <script src="Scripts/jquery-1.8.2.min.js"></script>
            $(document).ready(function () {
                    $("h2").text("mouse down event triggered");
    <h1 id="h1">Click here your Left mouse button.</h1>


How to attach mouse down event to a html element in jQuery

I hope it will help to you after reading it.

 Let's check live example

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like