//$(document).on('input', 'textarea' ,function(){adjustTextArea(this);}); $(document).on('input', 'textarea' ,function(){ var that = this; setTimeout(function(e) {adjustTextArea(that); }, 0);}); //$(document).on('paste', 'textarea' ,function(){setTimeout(function(e) {adjustTextArea(this); }, 0);}); var minLineHeight = 20; var lock = false; var debug = false; function resizeLoop(area){ var tb=$(area); var inputGroup = $(area).siblings('.input-group-btn').find('.btn'); var target = area.scrollHeight; //+ lineHeightOffset //+parseFloat(tb.css('borderTopWidth'))+parseFloat(tb.css('borderBottomWidth')); var current = tb.outerHeight(); if(current>0 && currentarea.scrollHeight && tb.height() < baseLine){ if(debug) console.log("resetting baseline from " + tb.height()); tb.height(baseLine); } resizeLoop(area); } function WireUpAdjustTextArea(){$('textarea').each(function(){adjustTextArea(this);});}