HTML:
0/200
JS:
//限制输入字数 function LimitedWordsNum() { $('#doctorIntroduction').keydown(function() { var curLength = $('#doctorIntroduction').val().length; if(curLength >= 200) { var num = $('#doctorIntroduction').val().substr(0, 200); $('#doctorIntroduction').val(num); weui.alert('超字数限制,多出的字符将被截断!'); } else { $('.textareaLength').text(curLength); } }) }