3

I want to get textarea text width. How do I get text width in pixels?

I do not want the text length.

2

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.