jQuery mousedown() Method
Example
Press down the left mouse button over a <div> element to insert some text:
$("div").mousedown(function(){
$(this).after("Mouse
button pressed down.");
});
Try it yourself »
Definition and Usage
The mousedown event occurs when the left mouse button is pressed down over the selected element.
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:
$(selector).mousedown()
Try it
Attach a function to the mousedown event:
$(selector).mousedown(function)
Try it
Parameter | Description |
---|---|
function | Optional. Specifies the function to run when the mousedown event is triggered |