$.fn.jGrow = function(iRows) { $(this).css({ overflow: "hidden" }).bind("keypress", function() { if(iRows == null) { if(($(this)[0].scrollHeight > $(this)[0].clientHeight) && !$.browser.opera) { $(this)[0].rows += 1; return true; } else { return true; } } else { if((($(this)[0].scrollHeight > $(this)[0].clientHeight) && !$.browser.opera) && $(this)[0].rows <= iRows) { $(this)[0].rows += 1; return true; } else if($(this)[0].rows > iRows) { $(this).css({ overflow: "auto" }); } else { return true; } } }); }