Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery ui checkbox button state

If I have a group of checkbox buttons, what is the correct way to determine the button state?

Right now I do this:

$('#group label').each(function() {
    if ($(this).attr('aria-pressed') == 'true') {
        /* Do something */
    }
});

But sometimes no checkbox buttons are checked and some still have aria-pressed = true. I don't understand it.

like image 445
mach77 Avatar asked Dec 28 '22 02:12

mach77


1 Answers

Use .is(':checked') on the jQuery object containing your checkbox to test if it's checked.

like image 88
ThiefMaster Avatar answered Jan 12 '23 19:01

ThiefMaster