The Input Hidden name property in HTML DOM is used to set or return the value of the name attribute. The form data which has been submitted to the server can be identified by the name attribute. The name attribute is also used for referencing form data on the client side using JavaScript.
Syntax:
- It returns the Input Hidden name property.
hiddenObject.name
- It is used to set the Input Hidden name property.
hiddenObject.name = name
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
- Difference between 'hidden' and 'aria-hidden' attributes in HTML
- HTML | DOM Input Hidden value Property
- HTML | DOM Input Hidden type Property
- HTML | DOM Input Hidden form Property
- HTML | DOM Input Hidden defaultValue Property
- HTML | DOM Input Hidden Object
- HTML | DOM Input Reset name Property
- HTML | DOM Input Datetime name Property
- HTML | DOM Input Date name Property
- HTML | DOM Input DatetimeLocal name Property
- HTML | DOM Input Checkbox name Property
- HTML | DOM Input Email name Property
- HTML | DOM Input Password name Property
- HTML | DOM Input Submit name Property
- HTML | DOM Input Text name Property
- HTML | DOM Input Number name Property
- HTML | DOM Input Search name Property
- HTML | DOM Input Range name Property
- HTML | DOM Input URL name Property
- HTML | DOM Input Radio name Property
Property Values: It contains single value name which is used to specify the name of the hidden input field.
Return Value: It returns a string value which represent the name of the hidden input field.
Example 1: This example illustrate how to return Input Hidden name property.
<!DOCTYPE html> <html> <head> <title> HTML DOM Input Hidden name Property </title> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <h2> DOM Input Hidden name Property </h2> <input type="hidden" id="GFG" name ="myGeeks" value="GeeksForGeeks"> <button onclick="myGeeks()"> Submit </button> <p id="sudo" style="color:green;font-size:30px;"></p> <!-- Script to use Input Hidden name property --> <script> function myGeeks() { var x = document.getElementById("GFG").name; document.getElementById("sudo").innerHTML = x; } </script> </body> </html> |
Output:
Before clicking on the button:

After clicking on the button:

Example 2: This example illustrates how to set Input Hidden name property.
<!DOCTYPE html> <html> <head> <title> HTML DOM Input Hidden name Property </title> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <h2> DOM Input Hidden name Property </h2> <input type="hidden" id="GFG" name ="myGeeks" value="GeeksForGeeks"> <button onclick="myGeeks()"> Submit </button> <p id="sudo" style="color:green;font-size:20px;"></p> <!-- Script to use Input Hidden name Property --> <script> function myGeeks() { var x = document.getElementById("GFG").name = "myInput"; document.getElementById("sudo").innerHTML = "The value of the name attribbute " + "was changed to " + x; } </script> </body> </html> |
Output:
Before clicking on the button:

After clicking on the button:

Supported Browsers: The browser supported by DOM input Hidden name property are listed below:
Recommended Posts:
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


