getNamedItem() in IE6 & IE7
How to access element’s attribute (<element name=”value”>
) in JavaScript?
It would seem that this code is the answer:
1 | return element.attributes["name"]; |
If you want to support IE 6 & 7 - it is not so easy!
Here is the appropriate equivalent for those browsers:
1 | for(var i=0; i<element.attributes.length; i++) { |
Yes, IE supports getNamedItem()
method only since version 8!
See: http://msdn.microsoft.com/en-us/library/ms536441(v=vs.85).aspx