Html-textarea-tag

提供:Dev Guides
移動先:案内検索

HTML-textareaタグ

説明

HTML <textarea>タグは、textarea要素を宣言するためにフォーム内で使用されます。これは、ユーザーが複数行にわたってテキストを入力できるようにするコントロールです。

<!DOCTYPE html>
<html>

   <head>
      <title>HTML textarea Tag</title>
   </head>

   <body>
      <form action = "/cgi-bin/hello_get.cgi" method = "get">
         Fill the Detail:
         <br/>

         <textarea rows = "5" cols = "50" name = "description">
            Enter your name
         </textarea>

         <input type = "submit" value = "submit"/>
      </form>
   </body>

</html>

これは、次の結果を生成します-

グローバル属性

このタグは、− link:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします

特定の属性

HTML <textarea>タグは、次の追加属性もサポートしています-

Attribute Value Description
autofocus html-5 autofocus Specifies that on page load the text area should automatically get focus.
cols number Specifies the width of the textarea based on the number of visible character widths.
disabled disabled Specifies the width of the textarea based on the number of visible character widths.
formhtml-5 form_id Specifies one or more forms.
maxlengthhtml-5 number Specifies the maximum number of characters in textarea.
name text Assigns a name to the input control.
placeholder html-5 text Specifies a short hint of the value in textarea.
readonly readonly Sets the input control to read-only. It won’t allow the user to change the value. The control however, can receive focus and are included when tabbing through the form controls.
requiredhtml-5 required Specifies that a textarea is required.
rows number Specifies the height of the textarea based on the number of visible lines of text. If there’s more text than this allows, users can scroll using the textarea’s scrollbars.
wrap html-5 hardsoft Specifies the text to be wrapped in textarea.

イベント属性

このタグは、− link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートします。

ブラウザのサポート

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes