Grouping Form Data

Example

<!DOCTYPE html>
<html>
<body>

<h2>Grouping Form Data with Fieldset</h2>
<p>The fieldset element is used to group related data in a form, and the legend element defines a caption for the fieldset element.</p>

<form action=”/action_page.php”>
<fieldset>
<legend>Personal information:</legend>
First name:<br>
<input type=”text” name=”firstname” value=”Mickey”>
<br>
Last name:<br>
<input type=”text” name=”lastname” value=”Mouse”>
<br><br>
<input type=”submit” value=”Submit”>
</fieldset>
</form>

</body>
</html>

Output

Grouping Form Data with Fieldset

The fieldset element is used to group related data in a form, and the legend element defines a caption for the fieldset element.

Personal information: First name:

Last name:


Updated: February 4, 2019 — 9:01 am
Java Script © 2019