Sunday, September 16, 2012
JavaScript Error – Submit is not a Function
If you get the JavaScript error “Submit is not a Function” then you are probably trying to call the Form’s Submit() Method, but you also have a button whitch is called Submit. This results in a conflict in the JavaScript becuse the Submit Method is already bound to the button.
The Solution is simply to change the name of the button so that name=”newname” (or what ever you prefer).
Labels:
HTML,
JavaScript,
Web Design,
Web development
Subscribe to:
Post Comments (Atom)

Thanks for this post. For us seo companies in south africa, it helped us with trying to deal with this type of error.
ReplyDeleteDuring my first time to do a project for a web design company in Perth, I've been dealing with this error for a dozen of times, everyday. Turns out I was only mistyping my entries.
ReplyDeleteI had my internship at long island web design and I would say that I'm quite knowledgeable with JS. I would say that naming the button as "namename" isn't advisable. When you write codes, name your button on what it does cause as you pile up the script its gonna get hard tracking and recalling a button name "newname".
ReplyDeleteThanks for your comment Ryan. For this post, I was more interested in pointing out what parameter to change to resolve the error, but you do raise a valid point.
DeleteA good naming convention can prevent a lot of problems later on. Beware of simply naming a button after its function, as that is what caused this problem in the first place. I usually use a combination of the controls type and its function, so a form submit button will be called “BtnSubmit”.
A basic but an important fix to a problem that is common to programmers. I commend you for sharing this, it has an even better explanation than w3school. But I'd prefer naming it as "submitbutton".
ReplyDeleteI agree with Ryan here. I've had this error several times as well. And I had to learn it the hard way, most especially when you are trying to create a web design for a new company that has trusted your skills in creating their website.
ReplyDeleteCorrect. To keep it short and simple, it only means Java Script needs organized codes. No mistyping of entries, no forgettable names, and absolutely no typographical errors. Sir Carl Bartlett, thanks for this post, and thanks to the commenters for the additional info.
ReplyDeleteNow I know why I always get that error. That’s funny because I didn’t thought of it that way.
ReplyDelete