HTML | DOM Input Hidden type Property
Last Updated :
31 Aug, 2022
The DOM input Hidden type Property is used for returning the type of form element the hidden input field is.
The Input Hidden type returns a string value which represents the type of form element the hidden input field is.
Syntax:
hiddenObject.type
Return Values: It returns a string value which defines the type of form element the input hidden field is.
Below program illustrates the Input Hidden type property:
Example: Returning the type of form element the Input Hidden type field is.
html
<!DOCTYPE html>
< html >
< body >
< center >
< h1 style = "color:green;" >GeeksForGeeks </ h1 >
< h2 >DOM Input Hidden type Property </ H2 >
< form id = "myGeeks" >
< input type = "hidden" id = "GFG"
name = "myGeeks" value = "GeeksForGeeks" >
</ form >
< button onclick = "myGeeks()" >Submit</ button >
< p id = "sudo" style = "color:green;font-size:30px;" >
</ p >
< script >
function myGeeks() {
var x = document.getElementById("GFG").type;
document.getElementById("sudo").innerHTML = x;
}
</ script >
</ body >
</ html >
|
Output:
Before clicking on the button :
After clicking on the button:
Supported Browsers: The browser supported by DOM input Hidden type Property are listed below:
- Google Chrome 1
- Edge 12
- Firefox 1
- Opera 2
- Safari 1
Share your thoughts in the comments
Please Login to comment...