Textarea2
Textarea2
by Nibin George
HTML
<textarea id="moo" rows="5" cols="50"></textarea>
JavaScript
$('#moo').on('keydown',function(){
var stringLength = document.getElementById("moo").value.length;
var count = Math.ceil( stringLength / document.getElementById("moo").cols );
if(count >=10){
$(this).css('overflow','scroll');
}else if(count >=5){
$(this).attr('rows', '10');
}
});