I have an HTML input tag and I want to change the value of it when clicking on a button, all before submitting the whole form.
I am trying to use getElementById(idOfInput).value = "value I want to set it to", but that doesn't seem to work.
Check out the jsfiddle here: http://jsfiddle.net/dchaddock/83NZu/1/
<input id="resetTesting" value="Testing" />
<button type="button" onclck="resetInput();">Testing</button>
function resetInput() {
document.getElementById("resetTesting").value = "I'm reset!";
}
Thanks!
onclck
attribute of your button a typo on this posting, or does it exist in your page? If the latter, that's at least part of your problem.