Javascript examples for DOM HTML Element:Input Hidden
Input Hidden value Property - Change the value of the hidden field:
<!DOCTYPE html> <html> <body> A hidden input field: <input type="hidden" id="myInput" name="country" value="Norway"> <button onclick="display()">Display value</button> <button onclick="change()">Change value</button> <script> function display() { var x = document.getElementById("myInput").value; console.log("The value of the hidden input field is: " + x); } function change() {/*from www . j a va2 s .co m*/ var x = document.getElementById("myInput").value="USA"; console.log("The value was changed to: " + x); } </script> </body> </html>