文本域随着输入而增加高度

<!DOCTYPE html>
<html>
<body>
<textarea name="mytextarea" cols="10" style="overflow-y:hidden;height:20px;" onpropertychange="this.style.height=this.scrollHeight+'px';" oninput="this.style.height=20+'px';this.style.height=this.scrollHeight+'px';"></textarea>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/a1015088819/article/details/68487442