Jquery ui button state

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

Now I am doing this:

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

But sometimes the checkboxes are not checked, and some still have aria-pressed = true . I do not understand this.

+4
source share
1 answer

Use .is(':checked') in the jQuery object containing your checkbox to check if it is checked.

+10
source

Source: https://habr.com/ru/post/1336627/


All Articles