Submit.click()

JavaScript1.0+, JScript1.0+ Nav2+, IE3+, Opera3+ Syntax

							submit.click()

Description

The click() method of an instance of the Submit object simulates a click on the submit button. Note that if you have an onClick event handler assigned to this button, it will not be executed.

Example

Listing 7.481 has a text field, a submit button, and a link. If the user clicks the link, a function will be called to check if the user entered any text. If the user did not, an alert box is displayed. If the user did enter text, the function submits the form by calling the click() method of the submit button.

Listing 7.481 Using the click() Method to Submit a Form
 <html> <head> <script language="JavaScript"> <!-- Hide // Define the submitForm ...

Get Pure JavaScript 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.