HTML Attributes
HTML form attribute
Associates an eligible control with a form elsewhere in the same document, overriding an ancestor form where applicable. Does not automatically associate descendants of a fieldset. Applicable elements include: <button>, <fieldset>, <input>, <object>, <output>, <select>, <textarea>. Check each element’s value rules.
Formal Syntax & Structure
html syntaxhtml
form="search"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| form | form element ID | Associates an eligible control with a form elsewhere in the same document, overriding an ancestor form where applicable. Does not automatically associate descendants of a fieldset. |
Working Example
Example Snippethtml
<form id="search"></form><label> Query <input form="search" name="q"></label><button form="search">Search</button>Browser Compatibility
Minimum supported versions across modern rendering engines
Blink (modern)
Chrome
1
Yes
EdgeHTML / Blink
Edge
12
Yes
Gecko
Firefox
1
Yes
WebKit
Safari
1
Yes
Presto / Blink
Opera
≤12.1
Yes
Desktop support for form on input only; other elements, input types, individual values and mobile behavior may differ.
HTML Living Standard