Input Hidden value Property - Submitting a form: change the value of the hidden field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Hidden

Description

Input Hidden value Property - Submitting a form: change the value of the hidden field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="#">
  A hidden field:<input type="hidden" id="myInput" name="country" value="Norway"><br>
  <input type="submit" value="Submit">
</form>//from w w  w .  j  a va2s  . co  m

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
    document.getElementById("myInput").value = "USA";
    document.getElementById("demo").innerHTML = "changed.";
}
</script>

</body>
</html>

Related Tutorials