(function ($) { $.fn.autogrow = function () { this.filter('textarea').each(function () { var $this = $(this), minHeight = $this.height(), shadow = $('
').css({ position: 'absolute', top: -10000, left: -10000, width: $(this).width(), fontSize: $this.css('fontSize'), fontFamily: $this.css('fontFamily'), lineHeight: $this.css('lineHeight'), resize: 'none' }).addClass('shadow').appendTo(document.body), update = function () { var t = this; shadow.css({"width": $(this).width()}); setTimeout(function () { var val = t.value.replace(//g, '>') .replace(/&/g, '&') .replace(/\n/g, '