JavaScript: Difference between ‘Mousedown’, ‘Mouseup’ and ‘Click’ events

Mousedown event trigger when either the left or right (or middle) mouse is pressed on the object;

Mouseup event trigger when either the left or right (or middle) mouse is released above the object after triggered mousedown event and held.

Click event trigger when the only left mouse button is pressed and released on the same object, requires the Mousedown and Mouseup event happened before Click event.

The normal expect trigger order: onMousedown >> onMouseup >> onClick

Testing in Chrome v58, the time between onMouseup and onClick events are around 7ms to 15ms

difference between 'mouseup' and 'click' events

difference between ‘mouseup’ and ‘click’ events

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA