A YUI 3 plugin which adds 'auto-height' functionality to textareas.
<script type="text/javascript" src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script> <script type="text/javascript"> YUI ({ gallery: "gallery-2012.05.09-20-27" }).use ("gallery-textarea-autoheight", function (Y) { Y.one("textarea").plug (Y.TextareaAutoheight); }); </script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script> <script type="text/javascript" src="textareaAutoheight-min.js"></script> <script type="text/javascript"> YUI ().use ("textareaAutoheight", function (Y) { Y.one("textarea").plug (Y.TextareaAutoheight); }); </script>
* If you pass maxRows parameter, it will add scrollbar after those many number of rows.
Y.one("textarea").plug (Y.TextareaAutoheight, {maxRows: 4});
* To adjust height manually:
Y.one("textarea").textareaAutoheight.adjustHeight();