1
我正在创建一个带有textarea
和Remarkable的降价编辑器。如果文本的长度大于最小值,我只想提交。我怎样才能像在我的输出被认为是文本的实际长度显着降价。获取实际文本长度
var CharCounter = React.createClass({
getText : function(){
if(this.props.count < this.props.min)
return (this.props.min - this.props.count) + ' more to go';
else if(this.props.count < this.props.max)
return (this.props.max - this.props.count) + ' left';
else
return 'Done';
},
render : function(){
return(
<p><small>{this.getText()}</small></p>
);
}
});
的问题是,如果我尝试直接使用文本区域价值。长度包括降价.ie ['*','**']
好吧。现在添加代码 – peter
太棒了,你还可以添加绑定Remarkable库的地方吗? – Pietro
我会说:'render'方法输出html,然后我将它放在一个div中,并通过jQuery获取'.text().length'。 – Pietro