We would like to know how to call submit() function to submit a form.
<html>
<body>
<form id="form1" method="post" action="javascript:console.log('Submitted')">
<label for="txtName">Name:</label><br />
<input type="text" id="txtName" name="txtName" /><br />
<input type="button" value="Submit Form" onclick="document.forms[0].submit()" />
<!-- w w w .j a va 2 s . c om-->
</form>
</body>
</html>
The code above is rendered as follows: