- Code: Select all
<input name="checkbox1" id="checkbox1" type="checkbox" value="abc" onClick="document.forms.hidden1.value = '1'>
<input name="hidden1" id="hidden1" type="hidden" value="0">
So, basically I'm changing the value of the hidden form from the checkbox onClick...Which is fine...But I also want when you click the checkbox again (to untick it) the hidden field reverts back to it's old value.
So I want if you click the checkbox first to tick it, the hidden1 value is put to 1. Then if you click that same checkbox again to untick it, I want the hidden1 value changed back to 0.
How do I do it?