
- 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 Select form Property
The HTML DOM select form property returns the reference of the form that contain the drop-down list.
Syntax
Following is the syntax −
object.form
Example
Let us see an example of HTML DOM select form property −
<!DOCTYPE html> <html> <head> <style> body{ text-align:center; background-color:#363946; color:#fff; } form{ margin:2.5rem auto; border:1px solid #fff; padding:2rem; } .drop-down{ display:block; width:35%; border:2px solid #fff; font-weight:bold; padding:2px; margin:1rem auto; outline:none; } button{ background-color:#db133a; border:none; cursor:pointer; padding:8px 16px; color:#fff; border-radius:5px; font-size:1.05rem; outline:none; } .show{ font-weight:bold; font-size:1.4rem; } </style> </head> <body> <h1>form Property Demo</h1> <form id="Form 1"> <legend style="font-weight:bold;">Form 1</legend> <p>Hi, Select your favourite subject:</p> <select class='drop-down' name="Drop Down List"> <option>Physics</option> <option>Maths</option> <option>Chemistry</option> <option>English</option> <option>Economics</option> <option>Hindi</option> <option>Biology</option> </select> </form> <button onclick="identify()">Identify form of drop-down</button> <p class="show"></p> <script> function identify() { var formId = document.querySelector(".drop-down").form.id; document.querySelector(".show").innerHTML = "Hi! I'm from " + formId; } </script> </body> </html>
Output
This will produce the following output −
Click on “identify form of drop-down” button to identify the form that reference the drop-down list −
- Related Articles
- HTML DOM Select disabled Property
- HTML DOM Select length Property
- HTML DOM Select multiple Property
- HTML DOM Select name Property
- HTML DOM Select value Property
- HTML DOM Select type Property
- HTML DOM Select size Property
- HTML DOM Select autofocus Property
- HTML DOM Select selectedIndex Property
- HTML DOM Textarea form Property
- HTML DOM Object form Property
- HTML DOM Legend form Property
- HTML DOM Form name Property
- HTML DOM Fieldset form property
- HTML DOM Form acceptCharset Property

Advertisements