User1670624291 posted
Hi,
I have a text area that adjusts to the number of lines in the content. I currently have a function that whenever I write it increases the line but when I save it it goes back to two lines.
I wanted him to adapt the number of lines to the text because i have foreach, how can I solve this?

@foreach (var item4 in item2.status)
{
@Html.TextAreaFor(m => @item4.Obs, new { @class = "Obs form-control form-control-sm font-weight-bold", disabled = true, style = "width: 400px;", rows = "auto", oninput = "auto_grow(this)" })
}
function auto_grow(element) {
element.style.height = "5px";
element.style.height = (element.scrollHeight) + "px";
}