` element: ``` var x = document.getElementById("myText").form.id; ``` *x* output result is:"> ` element: ``` var x = document.getElementById("myText").form.id; ``` *x* output result is:" />
Easy Tutorial
❮ Prop Style Borderbottomleftradius Jsref Isfinite Number ❯

form Attribute

Input Text Object

Example

Returns the form id that contains the <input type="text"> element:

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

x output result is:

myForm

Definition and Usage

The form attribute returns a reference to the form object that contains the text field.

This property returns the form object upon success.

Note: This property is read-only.


Browser Support

All major browsers support the form attribute.


Syntax

Technical Details

| Return Value: | A reference to the form element that contains the text field. Returns null if the text field is not in a form. | | --- | --- |

❮ Prop Style Borderbottomleftradius Jsref Isfinite Number ❯