转自:https://www.cnblogs.com/shinepolo/articles/1373113.html 1 <script type="text/javascript"> function show(a,b) { var maxl = 400 var s = document.getElementById(a).value.length + 1; if (s > maxl) document.getElementById(a).value = docum
//多余显示省略号 function wordlimit(cname, wordlength) { var cname = document.getElementsByClassName(cname); for (var i = 0; i < cname.length; i++) { var nowLength = cname[i].innerHTML.length; if (nowLength > wordlength) { cname[i].innerHTML = cname[i].inn
/** *textarea 字数限制 *obj textarea * maxlength 限制的最大字数 */ function textarealength(obj,maxlength){ var v = $(obj).val(); var l = v.length; if( l > maxlength){ v = v.substring(0,maxlength); $(obj).val(v); } $(obj).parent().find(".textarea-length"