HTML <fieldset> form Attribute
Definition and Usage
form
This attribute specifies the form to which the fieldset belongs.
The value of this attribute must be equal to the id attribute of the <form> element in the same document.
Example
The <fieldset> element outside the form (but still part of the form):
<form action="/action_page.php" method="get" id="form1"> <label for="favcolor">What is your favorite color?</label> <input type="text" id="favcolor" name="favcolor"> <input type="submit"> </form> <fieldset form="form1"> <legend>Personal Information:</legend> <label for="fname">Name:</label> <input type="text" id="fname" name="fname" form="form1"><br><br> <label for="lname">Surname:</label> <input type="text" id="lname" name="lname" form="form1"> </fieldset>
Syntax
<fieldset form="form_id">
Attribute Value
Value | Description |
---|---|
form_id |
Specifies the form element to which the <fieldset> element belongs. The value of this attribute must be the id attribute of the <form> element in the same document. |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Note:form
Attributes are new properties in HTML5.