Sometimes we need to submit web form by JavaScript, and need to use submit function of JavaScript. Suddenly we get an error of “submit is not a function”, we could not understand. Everyone knows that submit is a function in JavaScript. Many of times we have used in web form.
You have to keep your mind cool and find out what is the real problem why submit is not working.
Most of the time when submit is not working because of confliction of two same name of submit property in web page.
We use submit button in input type and put same name in button as submit
Example of wrong button name
<input type="submit" name="submit" value="Submit" />
Correct button name
<input type="submit" name="goSubmit" value="Submit" />
Check above button name in your webpage. Is submit name is used in submit button, if yes. Both name function name and button name will conflict with each other.
Simple change button name with other name instead of using submit name. This will solve the error of submit is not a function.
Mostly we do code like this
<html> <head> <title>Javascript submit is not a function</title> <script> function goSubmit() { document.frm.submit(); } </script> </head> <body> <form name="frm"> <a href="javascript:goSubmit()">Submit form Error if you use this</a> <input type="submit" name="submit" value="Submit" /> </form> </body> </html>
Demo




Link to Us