Open In App

How to specify a name for the fieldset using HTML ?

Last Updated : 22 Dec, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The <fieldset> tag in HTML5 is used to make a group of related elements in the form and it creates the box over the elements. The <fieldset> tag is new in HTML5.

The HTML <fieldset> name attribute is used to specify the name for the fieldset element. It is used to reference the form-data after submitting the form or to reference the element in a JavaScript.

Syntax:

<fieldset name="text">

Attribute Value: It contains the attribute value name which specify the name for the fieldset element. 

Example:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to specify a name for
        the fieldset using HTML ?
    </title>
  
    <style>
        h1,
        h2 {
            text-align: center;
        }
  
        h1 {
            color: green;
        }
  
        fieldset {
            width: 50%;
            margin-left: 22.5%;
        }
    </style>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
  
    <h2>
        How to specify a name for
        the fieldset using HTML ?
    </h2>
  
    <form id="myGeeks">
        <fieldset id="GFG" name="Geek_field">
            <legend>JAVA:</legend>
            Title:
            <input type="text">
            <br> Link:
            <input type="text">
            <br> User ID:
            <input type="text">
        </fieldset>
    </form>
</body>
  
</html>


Output:

Supported Browsers:

  • Google Chrome
  • Firefox
  • Opera
  • Apple Safari


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads