Learn how to handle Mouse events using javascript
Mouse event types
Simple events
Followings are the simplest mouse events:
mousedown
This is triggered when a mouse button is pressed down over an element
mouseup
This is triggered when a mouse button is released over an element
mouseover
This is triggered when the mouse comes over an element
mouseout
This is triggered when the mouse goes out of an element
mousemove
This is triggered on every mouse move over an element
Complex events
Also the following more complex events provides the browser.
click
Triggered by a mouse click: mousedown and then mouseup over an element
contextmenu
Triggered by a right-button mouse click over an element.
dblclick
Triggered by two clicks within a short time over an element
There is also a mousewheel event, but it’s not used. The scroll event is used to track scrolling instead. It occurs on any scroll, including keyboard scroll.
Events fire order
A single action may cause multiple events. For example, a click actually causes mousedown, mouseup and click in sequence.