Hello! It is impossible to make textress take the height of the content immediately after loading the page, and not when clicking on the text itself :-(
Code below
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>xiper.net - пример textarea подстраивается под высоту текста</title> <link href="http://www.xiper.net/examples/css/examples.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type="text/javascript" src="js/autoresize.jquery.js"></script> <script type="text/javascript"> jQuery(function() { jQuery('textarea').autoResize({ // On resize: onResize : function() { jQuery(this).css({color:'#fff', backgroundColor:'#fff'}); }, // After resize: animateCallback : function() { jQuery(this).css({color:'#000', backgroundColor:'#fff'}); } }); }); </script> <style type="text/css"> <!-- form{ margin:10px; } form div{ margin-bottom:10px; } textarea{ padding:10px; width:400px; border:1px solid #999; overflow:hidden; display:block; } --> </style> </head> <body> <form action="#" method="post"> <div> <textarea> AutoResize – a jQuery plugin (1kb minified) which enables animated auto-resizing of textarea form elements. When a user inputs text into a textarea the plugin automatically keeps track of their progress and will expand the textarea when needed. The plugin has been tested successfully in IE6/7, FF2/3, Opera9, Safari3 & Chrome. </textarea> </form> </body> </html>