开发者

jquery ui checkbox button state

开发者 https://www.devze.com 2023-02-06 18:23 出处:网络
If I have a group of checkbox buttons, what is the correct way to determine the button state? Right now I do this:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消