onClick( )


Adds an event handler that runs when the element is clicked.

An element receives a click event when a user clicks on the element and releases.

Method Declaration
Copy
Method Parameters
handlerfunctionRequired

handler(event: Event): void The name of the function or the function expression to run when the element is clicked.

Returns
Return Type:Element
Was this helpful?
Yes
No