Advertisement
Home Open Editor ❯

HTML <fieldset> name Attribute

Example

<form action="action.php" method="get">
  <fieldset name="userinfo">
    <legend>User Info:</legend>
    <label for="fname">First name:</label>
    <input type="text" id="fname" name="fname">
  </fieldset>
  
<br>
  
  <button type="button" onclick="form.userinfo.style.backgroundColor='tomato'"> Change background color of fieldset</button>
  <input type="submit" value="submit">
</form>

Try this code ❯

Meaning

This attribute specifies a name for a <fieldset>.

This attribute is used to reference elements in a JavaScript.

This attribute is used to reference form data after a form is submitted.

The caption for the fieldset is given by the first <legend> element nested inside it.

Note: It can be used for JavaScript interaction.


Standard Syntax

<fieldset name="text">...</fieldset>


Advertisement

Attribute Values

Value Description
text The name of the fieldset
Home Open Editor ❯
Advertisement