![](/img/trans.png)
[英]in Karate DSL, how do you escape single quotes when passing a variable within a java argument call
[英]How do you escape quotes in reactjs
我的 React 應用程序中的 escaping 引號有問題。
<textarea id="values"
placeholder="{ "name": "John", "test": true}"
onChange={this.handleChange2.bind(this)}>
</textarea>
我試過這樣做:
<textarea id="values"
placeholder="{ \"name\": \"John\", \"test\": true}"
onChange={this.handleChange2.bind(this)}>
</textarea>
但這對我不起作用。
嘗試改用單引號。
<textarea id="values"
placeholder='{ "name": "John", "test": true}'
onChange={this.handleChange2.bind(this)}>
</textarea>
要么
將引號移到{}內
<textarea id="values"
placeholder={"\"name\": \"John\", \"test\": true"}
onChange={this.handleChange2.bind(this)}>
</textarea>
如果您要傳遞值,也可以使用模板文字
<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?"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.