Javascript examples for DOM HTML Element:Input Hidden
Input Hidden value Property - Submitting a form: change the value of the hidden field:
<!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>