JavaScript Auto textarea resize
Auto textarea resize
<script type="text/javascript">
function fitToText()
{
if (this.scrollHeight>this.clientHeight)
{
this.style.height=(this.scrollHeight+20)+"px";
}
else
{
this.style.height="10px";
this.style.height=(this.scrollHeight+20)+"px";
}
}
</script>
<textarea id="bid" style="overflow-y: hidden; width: 300px; height: 50px"
oninput="fitToText.call(this)"
onpropertychange="if (event.propertyName.toLowerCase()=='value') fitToText.call(this)">
</textarea>