Event Performed Event Handler Description; click: onclick: When mouse click on an element: mouseover: onmouseover: When the cursor of the mouse comes over the element: mouseout: onmouseout: When the cursor of the mouse leaves an element: mousedown: onmousedown: When the mouse button is pressed over the element: mouseup: onmouseup.
The default actions for the onclick event are different depending on the type of the element on which the event has occurred. For example, if an onclick event occurs on an input:checkbox or input:radio element, the browser changes the checked state of the element. If an onclick event occurs on an anchor element, the browser loads the document specified by the anchor element's href property.
When you click the button, the click event occurs in the following order: button; div with the id container; body; html; document; The click event first occurs on the button which is the element that was clicked. Then the click event goes up the DOM tree, firing on each node along its way until it reaches the document object.
Definition and Usage. The click() method simulates a mouse-click on an element. This method can be used to execute a click on an element as if the user manually clicked on it.