jeudi 23 avril 2015

header checkbox not working first click

hey everyone i have two view

1- Index
2- Edit

i have a grid its header have one checkbox i want to click checkbox all rows checkbox is checkbox. in my header checkbox its not working first time when i click uncheck then check its work fine. i dont know why and what is the problem in my code please help

here is my index view its have Script

         function Check_Uncheck() {
            $('#SelectAll').click(function () {
                if (this.checked) {
                    $('.checkbox:enabled').each(function () {
                        this.checked = true;
                    });
                }
                else {
                    $('.checkbox:enabled').each(function () {
                        this.checked = false;
                    });
                }
            });
        }

and here is my Edit its have checkbox

<input type="checkbox" id="SelectAll" onclick="Check_Uncheck();" tabindex="3" />




Aucun commentaire:

Enregistrer un commentaire