Fog Juice Posted February 26, 2008 Share Posted February 26, 2008 Why doesn't document.getElementById('node').nodeName return the name of the element? It just returns INPUT in firefox. So if you have <input name="name of input" id="node" /> and you called that, it would return INPUT instead of "name of input". Anyone have any suggestions to get an elements name from firefox? Quote Link to comment Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 nodeName is deceiving, as it doesn't actually return the name attribute, rather it returns various details depending on what you are attaching it to. Here is a list: http://www.devguru.com/technologies/xml_dom/16036.asp Try this - It should work in firefox, but I'm dont think it will work in IE, so you will have to set up a conditional statement with separate code in IE. But try it out in IE first, as I may be wrong. document.getElementById('node').getAttribute("name") This should return the nodeName. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.