Get Input Hidden Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Hidden

Introduction

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>
<html>
<body>

<input type="hidden" id="myInput" value="java2s.com">

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

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

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

</body>
</html>

Related Tutorials