Name
HTMLInputElement.click( ) — simulate a mouse-click on a form element
Availability
DOM Level 1 HTML
Synopsis
void click( );
Description
This method simulates a mouse-click on a Button, Checkbox, Radio,
Reset, or Submit form element. It does not trigger the
onclick
event handler for the input element.
When called on Button elements, it may (or may not) produce the
visual appearance of a button-click, but it has no other effect since
it does not trigger the onclick event handler for the button. For
Checkbox elements, it toggles the checked
property. It makes unchecked Radio elements become checked but leaves
checked elements alone. When called on Reset and Submit elements, the
click( )
method causes the form to be reset or
submitted.
Get JavaScript: The Definitive Guide, Fourth 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.