Reputation: 23
I have a form with hidden fields with name.In javascript I am getting the form hidden value using following expression
document.getElementById('form-name').hidden-input-name.value
.
In all browsers it is working fine except IE7.In IE7,I am getting value as null or not an object for the above expression. Can anyone help me please.Thanks
Upvotes: 2
Views: 786
Reputation: 12705
Do you have any other element with attribute name = "form-name"
because older versions of IE didn't distinguish b/w id="" and name=""
Upvotes: 1
Reputation: 3932
untested but how about trying:
document.getElementById('form-name')["hidden-input-name"].value
Upvotes: 0
Reputation: 66388
The element name is not a valid JavaScript identifier, so you must use such syntax instead:
var value = document.getElementById('form-name').elements("hidden-input-name").value;
Upvotes: 0