I have a div with a fixed width of 30% and I am trying to find the length of the text within that div.
Check out my JSFiddle for the code.
The current code snippet I am using is:
var text=$('#test').text();
text=text.trim();
var len=text.length;
alert(text);
alert(len);
Currently, I am only able to get the length of the plain text. How can I calculate the length of the text after applying HTML tags to it?
Current behavior: Length is calculated as 105.
Expected behavior: 29 * total lines [ 29 characters per line in the div ]
Update
Additionally, I would like to include the length calculation of the green area shown in the image below.