How to use Form submit in JavaScript

This article describe about Form submit() Method in JavaScript.
  • 1554

Form submit() Method

This method is used to submits the form ( just like clicking the Reset button ).

Syntax

formObject.submit()

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript">

    function formSubmit() {

        document.getElementById("form1").submit();

    }

</script>

</head>

<body>

<p>Enter some text in the fields below, then press the "Submit form" button to submit the form.</p>

<form id="form1" action="default.aspx">

Enter First name: <input type="text" name="fname" /><br />

Enter Last name: <input type="text" name="lname" /><br /><br />

<input type="button" onclick="formSubmit()" value="Submit form" />

</form>

</body>

</html>

Output

pic22.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.