Input Text form Attribute

Definition and Usage

form The property returns a reference to the form containing the text field.

This property returns the form object on success.

Note:This property is read-only.

Example

Return the id of the form containing the <input type="text"> element:

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

Try It Yourself

Syntax

textObject.form

Technical Details

Return value:

Reference to the form element containing the text field.

Returns if the text field is not in the form. null.

Browser Support

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