Create an Input Hidden Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Hidden


You can create an <input> element with type="hidden" by using the document.createElement() method:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">create a Hidden Input Field</button>

<p id="demo"></p>

function myFunction() {//www  . j  a  va 2 s. c  o m
    var x = document.createElement("INPUT");
    x.setAttribute("type", "hidden");

    document.getElementById("demo").innerHTML = "The Hidden Input Field created.";


Related Tutorials