I have a text area for a chatbot. when the text area gets filled it wants to auto expand upwards and max height it can expand should be 100px. Is there anyway to do this?
.textbox-1{
padding-top:100px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="text-center textbox-1">
<input class="filter-searchbox py-2" type="search" name="search" placeholder="Search" />
</div>
Set the
onInputto resize the input field based on thescrollHeightattribute...So, if the
scrollHeightis above the max, we set the height to max, otherwise, we set the height toscrollHeight.Note: I changed it to a
textareasince that works more naturally with text flowing from top to bottom (whereas an input element doesn't work naturally with that).