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.
Use .is(':checked')
on the jQuery object containing your checkbox to test if it's checked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With