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 an开发者_如何转开发d 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.
精彩评论