Javascript examples for DOM HTML Element:Form Event
Use var in Javascript to define variable and set to input field
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/*from w ww . j a va 2 s .co m*/ console.log("hi!") var name = 'test'; //Sets the hidden value with "name" document.getElementById('hidden').value= name; }); </script> </head> <body> <input id="hidden"> </body> </html>