Automatically adjust height of input text field based on its content

Jon.S shared this question 5 months ago
Answered

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.

Comments (3)

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