I have a checkbox on a form which is unchecked by default as usual. now I want to perform two separated actions on checked and unchecked state of this checkbox.
this
We can do this using JavaScript, no need of jQuery. Just pass the changed element and let JavaScript handle it.
HTML
syn
JS
function doalert(checkboxElem) { if (checkboxElem.checked) { alert ("hi"); } else { alert ("bye"); } }
Demo Here