Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
81
rated 0 times [  83] [ 2]  / answers: 1 / hits: 34900  / 13 Years ago, wed, november 23, 2011, 12:00:00

Hi I want to be able to count the number of displayed characters in a Div with javascript/jquery. For example



<div id=mydiv>
<p>This is my div!</p>
</div>


I want to get the number 15 since that's how many chars in the div including spaces.



Thanks!


More From » jquery

 Answers
12
$('#mydiv').text().length


should do the trick.


[#88937] Tuesday, November 22, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eanskylerg

Total Points: 524
Total Questions: 107
Total Answers: 100

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
;