DOM HTMLElement.click() Method
The click() method simulates a mouse click on an element, firing its click event and running its default action.
Description
The click() method simulates a click on the element. It fires a click event that bubbles, and runs the element's default action, such as toggling a checkbox, submitting a form or opening a file picker for a file input. It doesn't move focus. It's commonly used to trigger a hidden file input from a styled button.
Because it runs the default action, calling click() on a submit button submits its form, on a link navigates, and on a label activates its associated control. Disabled form controls ignore it.
Browsers treat a click() call made inside a real user's click or key handler as part of that user action, so things like opening a file picker work. Called later, from a timer for example, some actions such as opening popups may be blocked.
Syntax
element.click()Return Value
None (undefined).
Example
Browser Support
The following information will show you the current browser support for the HTMLElement.click() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





