Name
HTMLElement.onclick: event handler invoked when the user clicks on an element â DOM Level 0
Synopsis
Function onclick
Description
The onclick
property of an
HTMLElement object specifies an event-handler function that is invoked
when the user clicks on the element. Note that onclick
is different from onmousedown
. A click event does not occur
unless a mousedown event and the subsequent mouseup event both occur
over the same element.
See Also
Element.addEventListener(
)
, Event
, MouseEvent
; Chapter 17
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.