Am I doing this wrong or is this impossible? I want to set the value of the checkbox to "0" if unchecked, and "1" if checked
<input type="checkbox" onChange="function() {$(this).val(this.checked? '1': '0')};" />
NOTE: I know how to do it outside of the onChange
event or by doing onChange="takeCareOfThis()"
, I'm looking to do it all inline
You just need to set the statement to be executed.
<input type="checkbox" onChange="$(this).val(this.checked? '1': '0');" />