justinmind-logo
 
Upvote 1

Automatically adjust height of input text field based on its content

Answered Jonathan Serex 4 years ago

Hello,

I have a single line "input text field" of type "textarea".

I would like that, while typing, whenever the text moves to the next line, that the field height automatically increases by one additional row.

I could not figure out how to achieve this. Can you help me ?

Thanks in advance for your answer.

Replies (2)
photo
1

Any idea ?

photo
1

The simplest way would be to create an "On Key Up" + "Resize" event that resizes the Input Text Field whenever the number of characters entered in the Input Text Field equals the number of characters that causes the line to break. Unfortunately this won't work perfectly because some characters take up more space in the Input Text Field than others.

photo
1

Thanks for your feedback Danielle.

Not ideal indeed.

photo
Leave a Comment
 
Attach a file