change just the value of a hidden field in a form
<input type="hidden" name="field" value="1" id="field">
Id like to know what I have to do to change just the value of this field.
1) Ive tryied with:
document.getElementById('field').value = "2";
Didnt work
2) Ive also tryied with:
<div id="field">1</div>
and in my javascript code:
document.getElementById("field").innerHTML = 2;
Didnt work as well.
I want to change only the value of the field. How do I do that?
Similar to document.getElementById('field').href='url2' where I can change the value of a url
<a href='url1'>X</a> -> <a href='url2'>X</a>

