Javascript 如何突出显示textarea中的文本
这里我使用jquery在文本区域内突出显示 这是我的短信区Javascript 如何突出显示textarea中的文本,javascript,reactjs,twitter-bootstrap,Javascript,Reactjs,Twitter Bootstrap,这里我使用jquery在文本区域内突出显示 这是我的短信区 <textarea className="form-control" spellcheck="false" placeholder="enter" id="exampleFormControlTextarea1" rows={4} style={{fontSize: '20px',strong:{ color:'#b1b1b1', fontSize
<textarea className="form-control"
spellcheck="false"
placeholder="enter"
id="exampleFormControlTextarea1" rows={4}
style={{fontSize: '20px',strong:{
color:'#b1b1b1',
fontSize:18,
}}}
onChange={this.handleChange}
value={this.state.input}
/>
预期产量
我得到了什么
handleChange(text){
this.setState({input:text.target.value});
this.updateHighlights();
}
updateHighlights() {
$('#exampleFormControlTextarea1').highlightWithinTextarea({
highlight: [
{
highlight: 'strawberry',
className: 'red'
},
{
highlight: 'blueberry',
className: 'blue'
},
{
highlight: /ba(na)*/gi,
className: 'yellow'
}
]
});
}