
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Input Text form Property
The HTML DOM Input Text form property is used for returning the form reference that contains the input text field. If the input text field is outside the form then it will simply return NULL. This property is read-only.
Syntax
Following is the syntax for input text form property.
textObject.form
Example
Let us look at an example for the Input text form property −
<!DOCTYPE html> <html> <body> <h1>Input Text form Property</h1> <form id="NEW_FORM"> USERNAME: <input type="text" id="TEXT1"> </form> <p>Get the form id by clicking on the below button</p> <button type="button" onclick="formId()">GET FORM</button> <p id="Sample"></p> <script> function formId() { var P=document.getElementById("TEXT1").form.id; document.getElementById("Sample").innerHTML = "The id of the form containing the text field is: "+P ; } </script> </body> </html>
Output
This will produce the following output −
On clicking the GET FORM button −
- Related Articles
- HTML DOM Input Text size Property
- HTML DOM Input Text type Property
- HTML DOM Input Text value Property
- HTML DOM Input Text autocomplete Property
- HTML DOM Input Text autofocus Property
- HTML DOM Input Text defaultValue Property
- HTML DOM Input Text disabled Property
- HTML DOM Input Text maxLength Property
- HTML DOM Input Text name Property
- HTML DOM Input Text pattern property
- HTML DOM Input Text placeholder property
- HTML DOM Input Text readOnly property
- HTML DOM Input Text required property
- HTML DOM Input Button form Property
- HTML DOM Input FileUpload form Property

Advertisements