Html-option-tag

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

HTML-<オプション>タグ

説明

HTML <option>タグは、ドロップダウンリストでオプションを定義するためにフォーム内で使用されます。

<!DOCTYPE html>
<html>

   <head>
      <title>HTML option Tag</title>
   </head>

   <body>
      <form action = "/cgi-bin/dropdown.cgi" method = "post">

         <select name = "dropdown">
            <option value = "Java" selected>Java</option>
            <option value = "Ruby">Ruby</option>
         </select>

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

</html>

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

グローバル属性

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

特定の属性

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

Attribute Value Description
disabled disabled Disables the input control. The button won’t accept changes from the user. It also cannot receive focus and will be skipped when tabbing.
label text Defines a label to use when using <optgroup>.
selected selected Defines the default option to be selected when page loads.
value text Specifies the value of the option to be sent to the server.

イベント属性

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

ブラウザのサポート

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