$("textarea").keyup(function(){ //console.log($(this).val().length); var L=$(this).val().length; if(L>100){//100为设定的字数 $(this).val($(this).val().substring(0,100)); } });
Powered by: 博客园 Copyright © 2024 股墓山庄庄主 Powered by .NET 9.0 on Kubernetes