patternreactCritical
React ignores 'for' attribute of the label element
Viewed 0 times
ignoresthereactattributeforlabelelement
Problem
In React (Facebook's framework), I need to render a label element bound to a text input using the standard
e.g. the following JSX is used:
However, this produces HTML missing the required (and standard)
What am I doing wrong?
for attribute.e.g. the following JSX is used:
Test
However, this produces HTML missing the required (and standard)
for attribute:Test
What am I doing wrong?
Solution
The
for attribute is called htmlFor for consistency with the DOM property API. If you're using the development build of React, you should have seen a warning in your console about this.Context
Stack Overflow Q#22752116, score: 802
Revisions (0)
No revisions yet.