![]() |
VOOZH | about |
The HTML DOM onmousedown event occurs when a mouse button is pressed over an element. It's useful for implementing interactive features that respond to mouse clicks or taps on web elements.
Syntax:
<element onmousedown="myScript">
object.onmousedown = function(){myScript};
object.addEventListener("mousedown", myScript);Related events for left-click:
Related events for right-click:
Example: In this example we demonstrating the onmousedown event. When mouse button is pressed over "HTML DOM onmousedown Event", text changes to "button pressed.
Output:
The browsers supported by HTML DOM onmousedown Event are listed below: