vendredi 28 août 2015

JQuery Checkbox click event never returns true

I can't seem to figure this out for something so simple. I am using jQuery 1.4.2 (though I tried later versions) in IE 11 and I can't seem to retrieve the checked value when the value should be true.

    <input id="<%=ID%>" class="abcdeCheckBox" type="checkbox" value="<%=ID%>" />

$('.abcdeCheckBox').bind('click', function()    
    {
        alert(this.checked);
        var indexCheck = cachedCheckedValues.indexOf(this.value);

        if(this.checked)
        {
            if(indexCheck == -1)
            {
                cachedCheckedValues.push(this.value);   
            }
        }
        else
        {
            cachedCheckedValues.splice(indexCheck, 1);
            alert("removing: " + this.value);
        }
    });

This never returns true and I can't understand why. It never adds the value to the array I have in the code.




Aucun commentaire:

Enregistrer un commentaire