Jeff Prachyl Jeff Prachyl - 1 year ago 61
Javascript Question

Call javascript function only when checkbox is NOT checked

I'm trying to figure out how to call a javascript function only when a checkbox is NOT checked.

here is my checkbox:

<input type="checkbox" id="icd" name="icd" value="icd" />


here is the name of the function:

planhide();


Thanks!

Answer Source
document.getElementById('icd').onchange = function() {
    if ( document.getElementById('icd').checked === false ) {
        planhide();
    }
};​