テキストボックスを自動で収縮するjavascript「Resizing textarea」
フォームを作成する際のテキストボックスの適切な大きさで悩むことがあります。
文字数にあわせて自動で収縮すればこんな悩みもなくなります。
Resizing form textbox example using Prototypeはprototypeベースで作成された自動収縮テキストボックス作成用スクリプトです。
使用方法
ResizeTextBox.jsとprototypeからprototype.jsをダウンロードします。
<script src="http://yourdomain/prototype.js" type="text/javascript"></script>
<script src="http://yourdomain/ResizeTextBox.js" type="text/javascript"></script>
上記をhead内に書き込み、textareaのonFocusに"new ResizingTextArea(this);"を付与します。
サンプル
Javascriptサンプルページ一覧
skuare.net