jump to navigation

Javascript error: submit is not a function June 26, 2009

Posted by Anoop Somasundaran in Javascript.
Tags:
add a comment

You might have got this javascript error when you were trying to submit the form using javascript. When I got this error for the first time it surprised me because I had used submit method many times to submit the form using javascript. This error wasted a couple of hours of mine to find out what was going wrong.

The reason for this error is that you might be using a submit button named ‘submit’ which causes a conflict in javascript since the submit method is already bound to that button.

<input name="submit" type="submit" value="download" />
Or
<html:submit property="submit"/> in struts form.

Changing the name of the button to anything other that submit will solve the problem and submit() call in your javascript will now work.

<input name="download" type="submit" value="download" />