使用jQuery对段落中的字符进行计数(* not * for input / textarea) [英] Count characters in paragraph using jQuery (*not* for input/textarea)
本文介绍了使用jQuery对段落中的字符进行计数(* not * for input / textarea)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上我想显示一个不同的CSS值,如果字符值大于等于50 。
一直在挣扎数小时: 使用 使用
$(#myDiv)。text()。length;
How do I work out in jQuery a character counter of a p/div tag?
Basically i want to show a different css value IF the character value >=50.
Been struggling for hours with it :)
解决方案
Use
$("#myDiv").text().length;
这篇关于使用jQuery对段落中的字符进行计数(* not * for input / textarea)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文