I have issues with escaping quotes on my react app.
<textarea id="values"
placeholder="{ "name": "John", "test": true}"
onChange={this.handleChange2.bind(this)}>
</textarea>
I have tried to do this:
<textarea id="values"
placeholder="{ \"name\": \"John\", \"test\": true}"
onChange={this.handleChange2.bind(this)}>
</textarea>
But that does not work for me.
Try using single quotes instead.
<textarea id="values"
placeholder='{ "name": "John", "test": true}'
onChange={this.handleChange2.bind(this)}>
</textarea>
OR
move the quotes inside {}
<textarea id="values"
placeholder={"\"name\": \"John\", \"test\": true"}
onChange={this.handleChange2.bind(this)}>
</textarea>
And if you want to pass in values, you could use template literal as well
<textarea
id="values"
placeholder={`"name": "John", "test": ${value}`}
onChange={this.handleChange2.bind(this)}
/>
<p>"What if this? what if that?"</p>
"What if this? what if that?"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.