A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-name-attribute/ below:

HTML name Attribute - GeeksforGeeks

HTML name Attribute

Last Updated : 12 Jul, 2025

The HTML name attribute labels elements, notably form inputs, identifying them for data submission. It's crucial for form processing and is often used in JavaScript DOM manipulation. Unique within a form.

Note: This attribute has been DEPRECATED and is no longer recommended.

Supported tags:

Element Description button Represents a clickable button. fieldset Groups related form elements. form Container for form controls. iframe Embeds another HTML page. input Accepts user input. map Defines an image map. meta Provides meta-information. object Embeds external content. output Displays calculation results. param Provides parameters for objects. select Creates a dropdown list. textarea Multiline text input area. keygen Generates cryptographic keys. Example of HTML name Attribute

Example 1: In this example we are displays GeeksforGeeks heading, form with username and password inputs, and submit button. Demonstrates the use of the button's name attribute.

html
<!DOCTYPE html>
<html>
    <head>
        <title>HTML button name Attribute</title>
    </head>

    <body>

        <h3>HTML button name Attribute</h3>

        <form action="#" method="get">
            Username:
            <input type="text" name="uname" />

            <br /><br />

            Password:
            <input type="password" name="pwd" />

            <br /><br />

            <button type="submit" value="submit">
                Submit
            </button>
        </form>
    </body>
</html>

Output: 

HTML name Attribute Example Output

Example 2: In this example the HTML select element with name attribute defines a dropdown list. Each option has a value. Important for form submission and JavaScript DOM manipulation. 

HTML
<!DOCTYPE html> 
<html> 

<head> 
    <title> 
        HTML Select name Attribute 
    </title> 
</head> 

<body style="text-align:center;"> 

    <h2 > 
    HTML Select name Attribute 
    </h2> 
    <br> Select your preferred 
          course from the drop-down list: 
    <br> 

    <select name="Courses Titles" id="myCourses"> 
        <option value="C++">c++</option> 
        <option value="Placement">Placement</option> 
        <option value="Java">Java</option> 
        <option value="Python">Python</option> 
    </select> 

</body> 

</html> 

Output: 

HTML name Attribute Example Output

Supported Browsers: The browsers supported by HTML | name Attribute are listed below: 



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4