Any one can tell why this happns? when I comment
// $(this).css("height",height1);
the height1 show correct height of textarea when I delete or add line , but when I uncomment this line, the alert is not correct, even I delete a line, the height only grow more and more.
Thanks!
I want to make this textarea height changes when I add or delete lines
<textarea style="width:380px;height:auto" name="MeStatusDes" id="MeStatusDes" ></textarea>
<script>
$("#MeStatusDes").keyup(function(e){
height1 = this.scrollHeight + "px";
alert(height1);
$(this).css("height",height1); // when I uncomment this, all alert is correct
});
</script>