Form Is Undefined Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the typeerror: document.form is undefined company Business Learn more about hiring developers or posting ads with us Stack Overflow document.form.name.value in javascript Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 document.aspnetform is undefined million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Form “is undefined” error in Firefox up vote 6 down vote favorite 1 I have this code, let say
Typeerror Document.forms 0 .elements Is Undefined
it's a.html
script // 1 : start document.frmSubmit.action = 'b.html'; document.frmSubmit.submit(); // 1 : end // 2 : start document.getElementById("frmSubmit").action = 'b.html'; document.getElementById("frmSubmit").submit(); // 2 : end Both 1 and 2 are working in IE (IE 8), but not in FF (3.6.10). Firebug gives me the following error: document.frmSubmit is undefined How can I fix it? javascript forms share|improve this question document.forms[1] is undefined edited Sep 29 '10 at 9:00 Andy Earnshaw 201k49354371 asked Sep 29 '10 at 8:51 tsurahman 94941123 Both methods should work fine (and do, for me). I suspect your error lies somewhere else and this isn't a true representation of the code you have. See jsfiddle.net/VL8C3, I replaced your methods with simple console outputs so you can see document.frmSubmit is defined. –Andy Earnshaw Sep 29 '10 at 9:05 is it a The error is only in FireFox, any ideas? javascript firefox share|improve this question edited May 31 '14 at 0:43 JakeGould 16.7k62851 asked May 31 '14 at 0:10 Tara Samons 82112 1 I'm assuming you miscopied the TypeError message, right? (document, not doucment.) –Qantas 94 Heavy May 31 '14 at 0:20 add a comment| 1 Answer 1 active oldest votes up vote 3 down vote accepted Your error is this: Typeerror: document.forms.myCity.optionname is undefined I believe the issue is in this element: