lundi 21 août 2017

JavaScript/jQuery: Check if checkbox is checked

I have following code:

function checkAll() {
    if ($("#chbxCheckAll").prop("checked") == true) {
        $(".chbxAttributes").prop("checked","true");
    }
    else {
        $(".chbxAttributes").prop("checked","false");
    }
}

If i check the checkbox with the id chbxCheckAll it works. Every checkbox with the class chbxAttributes will be checked. But if I uncheck the checkbox with the id chbxCheckAll it does nothing. Where is the error?




Aucun commentaire:

Enregistrer un commentaire