Open In App

HTML <a> name Attribute

Last Updated : 12 Jan, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

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

Note: The <a> name attribute is not supported by HTML5.

Syntax

<a name="name"> 

Attribute Values:

Attribute Value

Description

name

It describes the name of the <a> element.

Example: This example illustrates the use of an anchor name attribute in an HTML document.

html
<!DOCTYPE html>
<html>

<head>
    <title>HTML <a> name attribute</title>
</head>

<body>
    <h2>HTML <a> name Attribute</h2>
    <p>
        Welcome to
        <a href="https://www.geeksforgeeks.org/" 
           name="Geeks">
          GeeksforGeeks
          </a>
    </p>
</body>

</html>

Output:

Related DOM Property:

Supported Browsers:

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Opera 15
  • Apple Safari 1

Next Article

Similar Reads