Synopsis
Relevant to any element that can be
clicked
on, such as a button, this event occurs when the mouse is clicked on
an element that uses it. For some widgets that use this event, using
oncommand attribute (which covers clicking) is
recommended to avoid excluding keyboard selection. Here are some
commonly used properties associated with this event:
- button
This property tells you which mouse button was clicked. Its values
are 0 for the left mouse button, 1 for middle button, and 2 for right
button.
- detail
This property counts how many clicks occur over an element before the
mouse is moved. The values for this property start at 1 and increment
for every click.
Instead of catching double clicks this way, you can use the
ondblclick event.