jQuery mousedown() method
Example
in
element, insert some text:
$
(
"
div
"
)
.
mousedown
(
function
(
)
{
$
(
this
)
.
after
(
"
Mouse button pressed down.
"
)
;
}
)
;
Try it »
Definition and Usage
The mousedown event occurs when the mouse pointer moves over an element and the left mouse button is pressed.
The mousedown() method triggers the mousedown event, or adds a function to run when a mousedown event occurs.
**Tip:** This method is usually used together with mouseup() the method.
Syntax
Trigger the mousedown event of the selected element:
$(
selector
).mousedown()
Try it
Add a function to the mousedown event:
$(
selector
).mousedown(
function
)
Try it
| Parameters | Description |
|---|---|
| function | Optional. Specifies the function to run when the mousedown event is triggered. |
jQuery event methods