How do we submit a form using JavaScript?

 Posted by vishalneeraj-24503 on 12/6/2013 | Category: JavaScript Interview questions | Views: 3045 | Points: 40

We can write document.forms[0].submit() to submit a form in Javascript.

The submit() method submits the form same as submit button in HTML.It has no return value.Generally a Form is submitted,when we click on Submit Button.

<script type="text/javascript">

function submitform()
//or we can also write as

<input type="button" name="submit" value="Submit" onclick = "submitform();"/>

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response