Easy Tutorial
❮ Html Innerheight Misc When ❯

jQuery mousedown() Method

jQuery Event Methods

Example

Press the left mouse button on a <div> element to insert some text:

$("div").mousedown(function(){
    $(this).after("Mouse button pressed down.");
});

Definition and Usage

The mousedown event occurs when the mouse pointer is over an element, and the left mouse button is pressed.

The mousedown() method triggers the mousedown event, or attaches a function to run when a mousedown event occurs.

Tip: This method is often used together with the mouseup() method.


Syntax

Trigger the mousedown event for the selected elements:

Attach a function to the mousedown event:

Parameter Description
function Optional. Specifies the function to run when the mousedown event is triggered.

jQuery Event Methods

❮ Html Innerheight Misc When ❯