[英]on insert in textarea change other text
I like to change different content when insert text in texarea
. 我喜欢在texarea
插入文本时更改不同的内容。 Eg If I enter any text in the textarea
the id=res
and id=res2
should change to a static number. 例如,如果我在textarea
输入任何文本,则id=res
和id=res2
应该更改为静态数字。 Means out of "-.-"
should be "2.0"
. 表示"-.-"
应为"2.0"
。
Thank you 谢谢
html HTML
<textarea id="inptxt" ></textarea>
<div id="res" >-.-</div>
<div id="res2">-.-</div>
js JS
$("#inptxt").on("change input paste keyup", function() {
$("#res").html(jQuery(this).val());
$("#res2").html(jQuery(this).val());
});
You can use parseFloat
function http://jsfiddle.net/vineeshmp/ZVcG4/40/ 您可以使用parseFloat
函数http://jsfiddle.net/vineeshmp/ZVcG4/40/
$("#inptxt").on("change input paste keyup", function() {
$("#res").html(jQuery(this).val()?'2.0':'-.-');
$("#res2").html(jQuery(this).val()?'2.0':'-.-');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.