Jquery
JAVASCRIPT
$('textarea').unbind("input").on("input", function(){ $(this).removeAttr("style"); TextHeight=$(this).prop("scrollHeight"); if(TextHeight>40){ $(this).attr("style","height: "+(TextHeight)+"px;"); } })
CSS phù hợp
CSS
background: transparent; border: 0px; padding: 0px; line-height: 20px; width: 100%; resize: none; outline: 0px; font-family: inherit; min-height: 40px;
Css cho textarea thì dùng thẻ div wrap cái textarea là được
![[OFF]](/assets/images/off.gif)