HTML DOM Hidden name Property
Tutorial -- Learning is not just about technology, but also about dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
JavaScript Reference
JavaScript Objects
- JavaScript Array Object
- JavaScript Boolean Object
- JavaScript Date Object
- JavaScript Math Object
- JavaScript Number Object
- JavaScript String Object
- JavaScript RegExp Object
- JavaScript Global Properties/Functions
- JavaScript Operators
- JavaScript Error
Browser Objects
DOM Objects
- HTML DOM Document Object
- HTML DOM Element Object
- HTML DOM Attribute Object
- HTML DOM Event Object
- HTML DOM Console Object
- CSSStyleDeclaration Object
- DOM HTMLCollection
HTML Objects
- <a>
- <area>
- <audio>
- <base>
- <blockquote>
- <body>
- <button>
- <canvas>
- <col>
- <colgroup>
- <datalist>
- <del>
- <details>
- <dialog>
- <embed>
- <fieldset>
- <form>
- <iframe>
- <frameset>
- <img>
- <ins>
- <input> - button
- <input> - checkbox
- <input> - color
- <input> - date
- <input> - datetime
- <input> - datetime-local
- <input> - email
- <input> - file
- <input> - hidden
- <input> - image
- <input> - month
- <input> - number
- <input> - range
- <input> - password
- <input> - radio
- <input> - reset
- <input> - search
- <input> - submit
- <input> - text
- <input> - time
- <input> - url
- <input> - week
- <keygen>
- <link>
- <label>
- <legend>
- <li>
- <map>
- <menu>
- <menuItem>
- <meta>
- <meter>
- <object>
- <ol>
- <optgroup>
- <option>
- <param>
- <progress>
- <q>
- <script>
- <select>
- <source>
- <style>
- <table>
- <td>
- <th>
- <tr>
- <textarea>
- <title>
- <time>
- <track>
- <video>
Hidden name Property
Definition and Usage
The name property sets or returns the value of the name attribute of a hidden field.
The name property is used to pass data to the server after form submission, or to reference form data in JavaScript.
Note: Only the name attributes of form elements are passed as data values after form submission.
Syntax
Set the name property:
hiddenObject.name="_name_"
Return the name property:
hiddenObject.name
Browser Support
All major browsers support the name property.
Example
The following example returns the name of the hidden input field:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial(example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("hidden1").name;
alert(x);
}
</script>
</head>
<body>
<form>
<input type="hidden" id="hidden1" name="hidden1">
</form>
<button type="button" onclick="displayResult()">Display the name of the hidden input field</button>
</body>
</html>
YouTip