标签:
<textarea name="" id="FashionStatement" cols="30" rows="10"></textarea> <div id="statementRowChk"></div>
$(‘#FashionStatement‘).val(‘‘); var limitNum = 40; var pattern = ‘还可以输入‘ + limitNum + ‘字‘; $(‘#statementRowChk‘).html(pattern); $(‘#FashionStatement‘).keyup( function() { var remain = $(this).val().length; if (remain > 40) { pattern = ‘字数超过限制,请适当删除部分内容‘; } else { var result = limitNum - remain; pattern = ‘还可以输入‘ + result + ‘字‘; } $(‘#statementRowChk‘).html(pattern); } );
标签:
原文地址:http://www.cnblogs.com/hupan508/p/5924224.html