I have a div
which contains text (a string of length S
) of an arbitrary length, but a fixed size. Beyond a certain length (let's call it L
), the text is truncated and the remainder of the text is no longer visible. (Technically speaking, the range [0,L)
is visible, the range [L,S)
is not).
What I want to do is find the length L
for the text by counting only the visible number of characters in the div
. Any characters beyond the cut-off point should be disregarded.
I'm happy to use 3rd party libraries like jQuery etc if that will get the job done!