Search w3schools.com:

SHARE THIS PAGE

Form submit() Method

Form Object Reference Form Object

Definition and Usage

The submit() method submits the form (same as clicking the Submit button).

Syntax

formObject.submit()


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The submit() method is supported in all major browsers.


Example

Example

Create a button that submits the form:

<html>
<head>
<script>
function formSubmit()
{
document.getElementById("frm1").submit();
}
</script>
</head>
<body>

<form id="frm1" action="form_action.asp">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="button" onclick="formSubmit()" value="Submit form">
</form>

</body>
</html>

Try it yourself »


Form Object Reference Form Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]