你好我短信面板上的工作,我要检查,文本区域的长度现在我使用这些代码:当我将文本粘贴到文本区域警报显示验证长度
$("#txt").keydown(function() {
var len = $(this).val().length;
$("#lbl").text(len);
if (len <= 70) {
$("#lbl").text("One SMS");
if (confirm("more than one sms are you sure?")) {
$("#lbl").text(len);
}
}
else if (len >= 71 && len <= 133) {
$("#lbl").text("two SMS");
if (confirm("more than two sms are you sure?")) {
$("#lbl").text(len);
}
}
else if (len > 134 && len <= 199) {
$("#lbl").text("three SMS");
alert("more than three sms are you sure?");
}
});
我想和选择没有输入任何东西
谢谢你的建议?
第一个建议 - 提出可回答的问题。 “不完美”不是一个解释。 – zerkms
看看这个 [textarea长度计数](http://stackoverflow.com/questions/4506959/jquery-text-area-length-count) –
@zerkms例如,当我复制文本到textarea它不工作。 –