I am trying to figure out how to calculate just the width of one line of text with jquery.
I have the following text in an string
"Line 1
Line 2
Line 3
Line 4 Blah
Line 5"
When testing to find the width of the text which is shown on the page it always shows 77 px from where line 4 is the longest.
The text is put in using Jquery command .append() on the element id #text
the code used for the element is
<div id = 'terminal'><pre><span id = 'text'></span></pre>
How would I calculate just the width of Line 5?
Thanks - Ryan
spans are inline elements, then don't influence the text flow. If you do it correctly, it will work. Since you are not showing how you are doing it, we cannot help you with that.