<script type="text/javascript">
/*字数限制*/
$("#area").on("input propertychange", function() {
var $this = $(this),
_val = $this.val(),
count = "";
if (_val.length > 20) {
var new_val=_val.substring(0, 20);
$this.val(new_val);
}
count = 20 - $this.val().length;
$("#text-count").text(count);
});
</script>
文本域字数限制JS(兼容性好)
最新推荐文章于 2020-12-31 19:42:59 发布