Option form attribute

Definition and Usage

form The property returns a reference to the form containing the options.

This property returns the form object on success.

See also:

HTML Reference Manual:HTML <option> Tag

Example

The id of the form containing the <option> element with id="apple":

var x = document.getElementById("apple").form.id;

Try It Yourself

Syntax

optionObject.form

Technical Details

Return Value:

Reference to the form element containing the options.

If the option is not in the form, it returns null.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support