I want to get textarea text width. How do I get text width in pixels?
I do not want the text length.
I want to get textarea text width. How do I get text width in pixels?
I do not want the text length.
Simply wrap the text in a (invisible) span
and use jQuerys .width() to get the width.
Note that you should not, like others said, use a div
as it's a block-element - and depending on where/how you insert that, a block-element may auto-expand to the full available width and give bad results.