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.

When a user double-clicks an element, two click events are fired.

Note: Do not use the Editor Link panel to redirect on click when a link is already defined using the onClick() function. To avoid unpredictable behavior, remove the link from the Editor Link panel.

Method Declaration
Copy
Method Parameters
handlerfunctionRequired

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

Returns
Return Type:Element
Did this help?