Skip to content
Related Articles

Related Articles

Improve Article

How to specify the name of an input element?

  • Last Updated : 30 Dec, 2020

In this article, we will specify the name of an input element using HTML. To add the name of an input element, we use HTML <input> name attribute. The HTML <input> name attribute is used to specify a name for an <input> element. It is used to reference the form-data after submitting the form or to reference the element in JavaScript.


<input name="name">

Attribute Values: It contains a single value name that describes the name of the <input> element.



<!DOCTYPE html>
<html lang="en">
        How to specify the name of an
        input element using HTML?
<body style="text-align: center;">
    <h1 style="color: green;">
        How to specify the name of an
        input element using HTML?
    <form id="myGeeks">
        <label for="GFG">Username</label>
        <input type="text" id="GFG" name="GFG">
        <label for="GFG1">Password</label>
        <input type="password" id="GFG1" name="GFG1">
        <input type="submit" name="submit">




<!DOCTYPE html> 
        HTML Input name Attribute 
<body style="text-align:center;"
    <h2>HTML Input name Attribute</h2
    <form id="myGeeks"
        <input type="text"
            value="Manas Chhabra"


Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :