Call Javascript function only when checkbox is NOT checked
document.getElementById('icd').onchange = function() {
if ( document.getElementById('icd').checked === false ) {
planhide();
}
};
Include onchange option in the input tag and then add an intermediate function that checks and calls planhide() accordingly as follows:
<input type="checkbox" id="icd" name="icd" value="icd" onchange=check()/>
Then define the check() to do check the state and call the function as follows:
function check()
{
if(document.getElementById("icd").checked==false)
planhide();
}
Also instead of onchange you can also use onclick on the submit button option to call the check() function as like follows:
<input type="button" onclick=check()/>