View Full Version : Tell if textarea has scrollbars or not, or has 'overflowed'?

06-21-2008, 05:17 AM
Let's say you have a textarea 30px by 30px, you fill it with more than 10,000 text characters. It will obvious that the scrollbars will activated because there is so much text in the small space. In other words, it 'overflowed'. Now other than common sense, is it possible to tactically tell with javascript/css when text in a textarea has overflowed, or caused there to be the appearance of of scrollbars, height scrollbars and/or width scrollbars.

If so, I'd like to see some code to achieve this.

-Thanks http://bstats.freehostia.com/b.gif

06-21-2008, 05:23 AM
var who= some_textarea //(or any element);
var hasScroll= who.scrollHeight > who.offsetHeight;

06-21-2008, 05:39 AM
hoo anks :)
I"ll try it out.