What we are aiming for is to find a way to make a textarea grow in size either indefinitely or between specific limits, as we might not want to obtain indefinitely long pages.
1. Our usual directory and files layout needs to be set up. The
autogrow
directory will contain thejquery.js
file and the plugin file as well (jquery.autogrow.js
).2. Our HTML file looks very simple, as we just need a textarea element to let the magic happen.
<!DOCTYPE html> <html> <head> <script src="jquery.js"></script> <script src="jquery.autogrow.js"></script> <script> $(document).ready(function() { $(".autogrow").autoGrow(); }); </script> </head> <body> <form action="#" method="post"> <fieldset> <legend>Autogrowing textarea</legend> <textarea class="autogrow">This textarea will grow indefinitely.</textarea> </fieldset> </form> </body> </html>...