I have function for auto resize textarea height, it works on init and keyup:
autoHeight: function () {
function autoHeight_(element) {
// $(element).parents('.rowb').height(element.scrollHeight);
return jQuery(element)
.css({ "height": "auto", "overflow-y": "hidden" })
.height(element.scrollHeight);
}
return this.each(function() {
autoHeight_(this).on("input", function() {
autoHeight_(this);
});
});
}
It works, but problem is if I increase textarea height by mouse and then typo something it does't save prev height. How can i use autoheight only if content is bigger then textarea height?