-1

I am trying to set for in label , however the react engine is ignoring it. (I am probably doing it wrong )

Can someone help me with correct syntax for using "for" in label for JSX.

Here is my code snippet

<form role="form">
    <div className="checkbox checkbox-primary">
          <input type="checkbox" className="styled" id="checkbox1" name="foambox" ref="foambox" />
          <label for="checkbox1"><span style={{margin:10,cursor:'default'}}>For this delivery, would you like us to   take back the foam box </label>
    </div>
 </form>

What is the correct way to specify it ?

Sijan Shrestha
  • 2,136
  • 7
  • 26
  • 52

1 Answers1

2

htmlFor is the proper syntax as you can see in React Documentation

All attributes are camel-cased and the attributes class and for are className and htmlFor, respectively, to match the DOM API specification.

QoP
  • 27,388
  • 16
  • 74
  • 74