Open In App

What is the use of name Attribute in HTML ?

The “name” attribute in HTML is used to define the name of an element, such as a form control or an anchor tag. It primarily serves as an identifier for the element, allowing it to be referenced and manipulated by scripts or accessed via the DOM (Document Object Model) in JavaScript.

Syntax

<tagname name="name_value">Content</tagname>
Key Point Description
Uniqueness The value assigned to the “name” attribute should be unique within the context of the containing form or document.
Form Submission For form controls, the “name” attribute determines the key used to submit data to the server when the form is submitted.
Accessibility The “name” attribute facilitates accessibility by providing a reliable way to identify and interact with form elements programmatically.

Features

Article Tags :