<optgroup> 要素は、共通のラベルを持つ<option> 要素のグループを表します。label 属性でグループの名前を指定することができます。
- カテゴリー
- なし
- 配置場所
selectの子要素。- 内容
- 0個以上の
<option> 要素またはスクリプトサポート・エレメント。 - 属性
-
label="ラベル"- グループのラベル(名前)を指定します。この属性は必須です。
disabled[="disabled"]- 指定することでコントロール無効の使用不可の状態にします。
- グローバル属性
accesskey,autocapitalize,autofocus,class,contenteditable,data-*,dir,draggable,enterkeyhint,hidden,id,inputmode,is,itemid,itemprop,itemref,itemscope,itemtype,lang,nonce,spellcheck,style,tabindex,title,translate
サンプル
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<title>HTML5 › optgroup</title>
</head>
<body>
<h1>HTML5 › optgroup</h1>
<form method="post">
<select>
<option value="大人"></option>
<optgroup label="子ども">
<option value="幼児">幼児</option>
<option value="小学生">小学生</option>
<option value="中学生">中学生</option>
</optgroup>
</select>
<input type="submit" value="送信">
</form>
</body>
</html>
