Option form attribute

Definition and Usage

form 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

Return the id of the form that contains 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