How to count toggled buttons in jqueryui after a click event.

Posted by SystemicPlural on Stack Overflow See other posts from Stack Overflow or by SystemicPlural
Published on 2011-01-14T12:10:19Z Indexed on 2011/01/16 3:53 UTC
Read the original article Hit count: 207

Filed under:
|

I need to count how many buttons are toggled using the jqueryui checkbox button option - .buttonset(). This needs to happen when a button is toggled.

I added a unique class to the labels before applying the button set and have set a click event on it.

It fires fine, however it is firing before the jqueryui has processed the click so the result is out of date. How do I apply the click event after jqueryui has done its job?

$(".button-set").click(function(){
    var selected = $("#offer_list_4 label[aria-pressed=true]").length; // out of date
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui