An element receives a click
event when any of the following occurs:
- A pointing-device button (such as a mouse's primary button) is both pressed and released while the pointer is located inside the element.
- A touch gesture is performed on the element.
- Any user interaction that is equivalent to a click, such as pressing the Space key or Enter key while the element is focused. Note that this only applies to elements with a default key event handler, and therefore, excludes other elements that have been made focusable by setting the
tabindex
attribute.
If the button is pressed on one element and the pointer is moved outside the element before the button is released, the event is fired on the most specific ancestor element that contained both elements.
click
fires after both the mouseup
events have fired, in that order.
The event is a device-independent event — meaning it can be activated by touch, keyboard, mouse, and any other mechanism provided by assistive technology.