解决办法:
#descrip 是textarea的id,字数小于40;
$("#descrip").on(‘input‘,function(event) { if ($("#descrip").val().length >= 40) { $("#descrip").val($("#descrip").val().substring(0,40)); }
JS-textarea限制输入字数
原文:http://www.cnblogs.com/shenyangxiaohuo/p/5236711.html