Javascript examples for DOM HTML Element:Input Hidden
You can create an <input> element with type="hidden" by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">create a Hidden Input Field</button> <p id="demo"></p> <script> function myFunction() {//www . j a va 2 s. c o m var x = document.createElement("INPUT"); x.setAttribute("type", "hidden"); document.body.appendChild(x); document.getElementById("demo").innerHTML = "The Hidden Input Field created."; } </script> </body> </html>