getAttribute("for") returns null

IE6 returns null when trying to alert a <label> element's "for"-attribute using getAttribute("for"). It otherwise returns the correct value when doing: attributes["for"].value. FF returns the correct value in both cases.

Workaround: Use attributes["for"].value for compatability.

Test page Workaround is included
Reported by: Marc Eley.

(Orphaned), Explorer 5-6 Windows, Explorer 7 | Reported on 19 September 2005.

Atom RSS

This site heavily relies on bug reports created by its readers. Anyone can report a bug and be published.

Main navigation:

Search reports by browser:


(Add your own)

1 Posted by Mark Wubben on 19 September 2005

You can also use the `htmlFor` property.

2 Posted by Dirk Ginader on 7 February 2006

attributes["for"].value is not supported by Safari. So you better use the "htmlFor" property.

Post a comment

Commenting guidelines:

  1. When quoting specs, articles or your own research, please include a URL of the document.
  2. Test your stuff. When reporting browser behaviour, make sure that your report is correct.