I'm trying to create an autosize function where it resizes the textarea height based on the text context. However the content comes from the input elements from the form, so the user will enter it in the form. For example:
<input placeholder="name" value=""/>
<input placeholder="address" value=""/>
<input placeholder="company" value=""/>
<input placeholder="telephone" value=""/>
<textarea value={this.getFinalSentence()}></textarea>
So in this case, the user will enter its information on the input element. Say, the textarea min-height: 40px
, if the information data is longer then textarea
height it will increase.
Has anyone encountered this problem? So far I was able to resize the textarea if user edits the textarea, but not from the inputs. Your help will be appreciated.