HTML | DOM Option form Property
The Option form Property in HTML DOM is used for returning the reference of the form that belongs to Option Element. This Property is read-only that returns a form object on success.
Syntax:
optionObject.form
Return Values: It returns a reference to the form that contains an Option Element. It returns a null value if the option is not in the Form.
Example: This Example returns an Option Form Property.
<!DOCTYPE html> <html> <head> <title> DOM option form Property </title> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM option Form Property</h2> <form id="myGeeks"> <select id="GFG"> <option id="sudo"> Choose an option </option> <option value="html"> HTML </option> <option value="java"> JAVA </option> <option value="C++"> C++ </option> <option value="php"> PHP </option> <option value="perl"> PERL </option> </select> </form> <br> <br> <br> <br> <br> <br> <br> <button onclick="myGeeks()"> Submit </button> <h3 id="demo"></h3> <script> function myGeeks() { var x = document.getElementById( "sudo").form.id; document.getElementById( "demo").innerHTML = x; } </script> </body> </html> |
Before Clicking On Button:

After Clicking On Button:

Supported Browsers: The browsers supported by DOM Option form Property are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Recommended Posts:
- HTML | DOM Option value Property
- HTML | DOM Option text Property
- HTML | DOM Option selected Property
- HTML | DOM Option label Property
- HTML | DOM Option disabled Property
- HTML | DOM option index Property
- HTML | DOM Option defaultSelected Property
- HTML | DOM Form name Property
- HTML | DOM Form autocomplete Property
- HTML | DOM form method Property
- HTML | DOM Form target Property
- HTML | DOM Form action Property
- HTML | DOM Button form Property
- HTML | DOM Form noValidate Property
- HTML | DOM Textarea form Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



