: INPUT 要素
最終更新:2026-09-12
<input>INPUT 要素
<input> 要素は最も一般的なフォーム部品で、さまざまな入力欄を作成します。type 属性でテキスト・パスワード・チェックボックス・ラジオ・日付選択などを切り替えます。空要素です。
| カテゴリ | フォーム |
|---|---|
| コンテンツモデル | なし(空要素) |
| 許可される親要素 | フレージングコンテンツを受け入れる要素(通常は <form> 内) |
| 閉じタグ | 自己完結 — 閉じタグ不要 |
| ステータス | 標準 |
📝 構文
<input type="text" name="フィールド名" placeholder="ヒントテキスト">
⚙️ 属性
この要素はグローバル属性に加え、以下の属性をサポートします:
| 属性 | 値 | 説明 |
|---|---|---|
type | Keyword | The type of the input, determines the control's form.
|
name | Text | The field name submitted with the form; groups radio buttons. |
value | Text | The current or default value. |
placeholder | Text | Hint text shown when the field is empty. |
required | Boolean | Marks the field as required. |
disabled | Boolean | Disables the field; not submitted. |
readonly | Boolean | Read-only; visible but not editable. |
maxlength | Number | Maximum number of characters. |
checked | Boolean | Default checked state for checkbox/radio. |
▶ サンプル
下のコードを編集して、playground でリアルタイム結果を確認:
🌐 ブラウザサポート
| ブラウザ | |||||
|---|---|---|---|---|---|
| <input> | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| すべての主要ブラウザでサポート | |||||
ヒント: 必ず name 属性を設定しましょう。設定しないとフィールドの値が送信されません。