HTML <入力>フォーム属性

❮HTML<input>タグ

HTMLフォームの外部にある入力フィールド(ただし、フォームの一部):

<form action="/action_page.php" id="form1">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <input type="submit" value="Submit">
</form>

<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname" form="form1">

定義と使用法

form属性は、要素が属するフォームを指定します <input>


ブラウザのサポート

表の数字は、属性を完全にサポートする最初のブラウザーバージョンを示しています。

Attribute
form Yes Yes Yes 5.1 10.6

構文

<input form="form_id">

属性値

Value Description
form_id Specifies the form element the <input> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document.

❮HTML<input>タグ