Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

textarea width (minus scrollbar) using jQuery

Here's a quickie.

Basically, I want the width of a textarea element -- minus the width of the scrollbar if one is present. I could just use the clientWidth DOM property, but I don't know if this is cross-browser. I'm sure jQuery has some method (.width() returns the width including scrollbar), but I can't seem to figure out what it is.

Thanks!

like image 711
Nick Avatar asked Oct 13 '22 19:10

Nick


1 Answers

clientWidth is cross browser compatible as reported by quirksmode.org (an authority on the matter.) http://quirksmode.org/dom/w3c_cssom.html

like image 162
Macy Abbey Avatar answered Oct 18 '22 03:10

Macy Abbey