Advertisement
Home Open Editor ❯

HTML <fieldset> form Attribute

Example

<form action="action.php" method="get" id="form1">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname" form="form1"><br>
  <input type="submit">
</form>

<fieldset form="form1">
  <legend>User info:</legend>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname" form="form1">
</fieldset>

Try this code ❯

Meaning

This attribute takes the value of the id attribute of a <form> element and to be part of <fieldset>, if it is not inside the form it will work.


Standard Syntax

<fieldset form="formId">...</fieldset>


Advertisement

Attribute Values

Value Description
formId Specifies the form element the <fieldset> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document or page.
Home Open Editor ❯
Advertisement