This has been asked, but as it seems not for Javascript.
I would like to create a TextArea that has two sets of font sizes, one for when it contains less than 3 lines and one for when it contains more than that.
The only problem is that not only will the number of lines in the Textarea affect the chosen font-size, it will also be the amount of content, as when someone just enters a straight line of text without even a single newline, the Textarea will break the lines (using another wrap where horizontal scrolling becomes available is not a solution, unfortunately).
I created a detailled jsFiddle: http://jsfiddle.net/kF9LY
How can i measure the .value content of the Textarea in a fashion that will give me a clear calculation of the lines used, either by newlines or by content exceeding the width of a single line (and thus being displayed in the second) ?