Fieldset Tag In HTML: What are The Uses Of Fieldset Tag In HTML Form

  • Post category:HTML
  • Post author:
  • Post last modified:June 2, 2022
  • Reading time:5 mins read
You are currently viewing Fieldset Tag In HTML: What are The Uses Of Fieldset Tag In HTML Form

When you are designing an HTML Form sometimes you need to group HTML Form elements. Here the fieldset tag comes into existence. The fieldset tag in HTML is used to group HTML Form other elements. And the legend tag defines the caption for the fieldset element.

Here is the full tutorial on the HTML Form fieldset tag and its attributes.

Fieldset Tag – syntax

Fieldset Tag In HTML start with the opening <fieldset> tag and close with the closing </fieldset> tag.

<fieldset>....</fieldset>

Example

<form action="action_page">
<fieldset>
  <legend>Personal Information</legend>
  <label>Name</label>
  <input type="name">
  <label>Mobile</label>
  <input type="number">
  <label>Age</label>
  <input type="number">
</fieldset>
</form>
Personal Information



Fieldset Tag – Attributes

  • disabled – the disabled attribute disables all the form elements under the fieldset tag these elements are only readable and the elements will not be submitted when the form is submitted.
  • name – the name attribute defines a name to the fieldset element.

Fieldset element disabled Attribute

The fieldset element disabled attribute make all the element disabled under the fieldset element. These elements can only be read even if these elements will not be submitted when the form is submitted.

<form action="action_page">
<fieldset disabled>
<label>Name</label>
<input type="name">
<label>Mobile</label>
<input type="number">
<label>Age</label>
<input type="number">
</fieldset>
</form>


Fieldset element name attribute

The fieldset element name attribute gives a name to the fieldset element.

<form action="action_page">
<fieldset disabled name="contact">
<label>Name</label>
<input type="name">
<label>Mobile</label>
<input type="number">
<label>Age</label>
<input type="number">
</fieldset>
</form>


Chapter Summary

  • HTML Form Fieldset element are starts with the opening <fieldset> tag and close the closing </fieldset> tag.
  • HTML Form Fieldset tags are used to Group HTML Form Elements, And the Legend tag is used to define the caption of the group.
  • The Grouping HTML Form elements are write between the opening <fieldset> tag and the closing </fieldset> tag.

Ashim Khatua

Professionally Web Developer since 2015, And also a Blogger. I am the founder of SiteCodings.com. I love to share my knowledge, which I earned the past few years. I want to share my knowledge with you through my Blog. Keep Reading.

Leave a Reply