I reference the hidden field like:
var h = document.getElementById('myHiddenField');
How can I set the value to 100, and then output the value using a simple alert();?
I reference the hidden field like:
var h = document.getElementById('myHiddenField');
How can I set the value to 100, and then output the value using a simple alert();?
var h = document.getElementById('myHiddenField');
h.value = 100;
alert(h.value);
//get value
var hidderValue = document.getElementById('myHiddenField').value;
//set value
document.getElementById('myHiddenField').value = 200;
The value
property of the element.
Maybe you want to set hidden field's value IN the html part. To do so write:
<input type="hidden" id="myHiddenField" value="100"></input>