I have made an array of element ID's for radio buttons like so:
var buttons = [$('#first'), $('#second'), $('#third'), $('#fourth')];
What I am now trying to do is, check to see if each one is checked and if so, add a class to something, else add a class to something else. I know how do this separately for each individual id:
if($('#first').is(':checked')) {
$('.cb-enable').addClass('selected');
}
else {
$('.cb-disable').addClass('selected');
}
I tried using if($('buttons').is(':checked')) { but it doesn't work.
Can someone please helps me on this one?
$('buttons')have to do with your buttons array? None of your code ever uses the buttons array.buttons.each(function(index, value){value.is(':checked')});.cb-*elements?