dimanche 6 décembre 2015

jQuery is setting checkbox value as checked but not showing as checked

Hello I have a jQuery code to set a specific checkbox input as checked

The code works well and when I log the check value it says true as it's checked, but it's not shown as checked..

Here's the code:

        $(document).ready(function(){
            var checkCount = 0;
            debugger;
            //Setting all the checkboxes as unchecked
            $("#dropmenuCheckboxDropDown li input")[0].click();
            $("#dropmenuCheckboxDropDown li input").each(function(){
                if ($(this).val()==getUrlVars()["SurveyId"] && checkCount!=0){
                    $(this).prop("checked",true);
                    }
                checkCount++;
            });
            $("#dropmenuCheckboxDropDown li input").each(function(){
                    console.log($(this)[0].checked);
            });
        });

Thank you

Aucun commentaire:

Enregistrer un commentaire