We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

HTMLSelectElement.form

The HTMLSelectElement.form read-only property returns a HTMLFormElement representing the form that this element is associated with. If the element is not associated with of a <form> element, then it returns null.

Syntax

Edit

aForm = aSelectElement.form.selectname; 

Example

HTML

<form action="http://www.google.com/search" method="get">
 <label>Google: <input type="search" name="q"></label> <input type="submit" value="Search...">
</form>

Javascript

A property available on all form elements, "type" returns the type of the calling form element. For SELECT, the two possible values are "select-one" or "select-multiple", depending on the type of selection list. The below code gives all SELECT elements in a particular form a CSS class of "selectclass":

<script type="text/javascript">
var form_element = document.getElementById('subscribe_form');
var vist = form_element.style;
if (vist.display=='' || vist.display=='none')
{
  vist.display = 'block';
}
else
{
  vist.display = 'none';
}
</script>

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'HTMLSelectElement' in that specification.
Living Standard No change since the latest snapshot, HTML5.
HTML5
The definition of 'HTMLSelectElement' in that specification.
Recommendation Initial definition, snapshot of HTML Living Standard.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

 
Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Chrome Edge Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)

Document Tags and Contributors

Contributors to this page: innayarantseva, libbymc, Rakhisharma, teoli
Last updated by: innayarantseva,