Open In App
Related Articles

HTML <a> name Attribute

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
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

Last Updated : 12 Jan, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads