Get Input Hidden Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Hidden


The Input Hidden object represents an HTML <input> element with type="hidden".

You can access an <input> element with type="hidden" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<input type="hidden" id="myInput" value="">

<button onclick="myFunction()">get the value of the hidden input field</button>

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

function myFunction() {/*ww w.j a v a  2s  .  c om*/
    var x = document.getElementById("myInput").value;
    document.getElementById("demo").innerHTML = x;


Related Tutorials