javascript - Change the value of a checkbox inline using the onChange attribute -


am doing wrong or impossible? want set value of checkbox "0" if unchecked, , "1" if checked

<input type="checkbox" onchange="function() {$(this).val(this.checked? '1': '0')};" /> 

note: know how outside of onchange event or doing onchange="takecareofthis()", i'm looking inline

you need set statement executed.

<input type="checkbox" onchange="$(this).val(this.checked? '1': '0');" /> 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -