HTML | DOM Fieldset form Property
The Fieldset form property in HTML DOM is used to set or return the reference to the form that containing the <fieldset> element. It is read-only property that returns a form object on success.
Syntax:
fieldsetObject.form
Return Value : It returns a string value representing the reference of the form to which the fieldset element belongs.
The below program illustrates the use of the DOM Fieldset form property in HTML DOM:
Example: This example returns the Fieldset form Property.
HTML
<!DOCTYPE html>
< html >
< head >
< title >
DOM fieldset form Property
</ title >
< style >
h1, h2, .title {
text-align: center;
}
fieldset {
width: 50%;
margin-left: 22%;
}
h1 {
color: green;
}
button {
margin-left: 35%;
}
</ style >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >DOM fieldset form Property</ h2 >
< form id="myGeeks">
< div class="title">
Suggest article for video:
</ div >
< fieldset id="GFG">
< legend >JAVA:</ legend >
Title: < input type="text">< br >
Link: < input type="text">< br >
User ID: < input type="text">
</ fieldset >
</ form >< br >
< button onclick="Geeks()">Submit</ button >
< p id="sudo" style="font-size:25px;text-align:center;"></ p >
< script >
function Geeks() {
var g = document.getElementById("GFG").form.id;
document.getElementById("sudo").innerHTML = g;
}
</ script >
</ body >
</ html >
|
Output:
- Before Clicking on Button:
- After Clicking on Button:
Supported Browsers: The browser supported by DOM Fieldset Form property are listed below:
- Google Chrome
- Edge 12 and above
- Internet Explorer
- Firefox
- Opera
- Safari
Last Updated :
13 Feb, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...