Edit This Code:
<!DOCTYPE html>
<html>
<body>

<form action="form_action.asp">
  A hidden field:<input type="hidden" id="myInput" name="country" value="Norway"><br>
  <input type="submit" value="Submit">
</form>

<p>Notice that the hidden field above is not shown to a user.</p>

<p>Submit the form to see the value of the name and value attribute of the hidden input field, as received input.</p>

<p>Click the "Try it" button to change the value from "Norway" to "USA".</p>

<button onclick="myFunction()">Try it</button>

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

<script>
function myFunction() {
    document.getElementById("myInput").value = "USA";
    document.getElementById("demo").innerHTML = "The value of the value attribute was changed. Try to submit the form again.";
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy