revision:
Value of the name attribute works as an identifier of the element.
The name attribute can be used on the following elements: <a>, <button>, <fieldset>, <from>, <iframe>, <input>, <map>, <meta>, <object>, <output>, <param>, <select>, <textarea>.
The name attribute can be used to reference the element in a JavaScript.
Difference between "id attribute" and "name attribute":
Like the id attribute, the name attribute must begin with a letter and is case sensitive, but unlike the id attribute, it can be not unique.
The name attribute cannot be referenced in CSS. In Javascript, it is referenced with getElementsByName().
<element name=" "></element >
For a <form> element, the name attribute is used as a reference when the data is submitted.
For an <iframe> element, the name attribute can be used to target a form submission.
For a <map> element, the name attribute is associated with the <img>'s "usemap attribute" and creates a relationship between the image and the map.
For a ><meta> element, the name attribute specifies a name for the information/value of the "content attribute".
For a <param> element, the name attribute is used together with the value attribute to specify parameters for the plugin specified with the <object> tag.
<form style="margin-left:3vw;" action="/action_page.php" method="get"> <fieldset name="personalia"> <label for="fname">First name:</label> <input type="text" id="fname" name="fname"> </fieldset> <br> <button type="button" onclick="form.personalia.style.backgroundColor='yellow'"> Change background color of fieldset</button> <input type="submit"> </form>
<form style="margin-left:3vw;" action="/action_page.php"> <label for="fname">First name:</label> <input type="text" id="fname" name="fname"><br><br> <label for="lname">Last name:</label> <input type="text" id="lname" name="lname"><br><br> <input type="submit" value="Submit"> </form>