Атрибут формы HTML <button>
Пример
Кнопка, расположенная вне формы (но все же часть формы):
<form action="/action_page.php" method="get" id="form1">
<label for="fname">First
name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname"
name="lname">
</form>
<button type="submit" form="form1"
value="Submit">Submit</button>
Определение и использование
Атрибут form
указывает форму, которой принадлежит кнопка.
Значение этого атрибута должно быть равно id
атрибуту
<form>
элемента в том же документе.
Поддержка браузера
Цифры в таблице указывают на первую версию браузера, которая полностью поддерживает этот атрибут.
Attribute | |||||
---|---|---|---|---|---|
form | 10.0 | 16.0 | 4.0 | 5.1 | 9.5 |
Синтаксис
<button form="form_id">
Значения атрибутов
Value | Description |
---|---|
form_id | Specifies the form element the <button> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document. |
❮ HTML-тег <button>