HTML <select> form Attribute

❮ HTML <select> tag

Example

<form action="action.php" id="langform">
	<input type="submit">
</form>

<label for="lang">Choose your option:</label>
<select name="language" form="langform" id="lang">
  <option value="HTML">HTML</option>
  <option value="CSS">CSS</option>
  <option value="JavaScript">JavaScript</option>
</select>

Meaning

The form attribute should be set to a string that corresponds to the id of the <form> element that the button is associated with.

This allows <form> elements in one form to trigger actions in others.

Note: By default, the select element is associated with its nearest ancestor <form> element.


Standard Syntax

<select form="formId">
  <option>text</option>
</select>



Browser Support




Status







Attribute Values

Value Description
formId Ihe ID of a <form> element in the element’s owner.Associate the select element with its form owner.
❮ HTML <select> tag