user1283226
user1283226

Reputation: 17

jquery combing selectors

to be short : i want to select all the 'checked' checkboxes in my page except one of them !
so i tried this :

$('input:checkbox').not('#SpecificChbx').is(':checked')

i've tried this too :

$('input:checkbox:not(#SpecificChbx)').is(':checked')

i've tried so many alternatives but still not working .. any help please ?
this is a jsfiddle example

Upvotes: 0

Views: 42

Answers (2)

voigtan
voigtan

Reputation: 9031

.is returns true or false (if one of the matches checkboxes is checked it will return true, else false), what you want is a jQuery collection: $('input:checkbox:checked:not(#SpecificChbx)')

Upvotes: 6

Sushanth --
Sushanth --

Reputation: 55750

You need to iterate over them...

$('input:checkbox').not('#SpecificChbx').filter(function () {
    return $(this).is(':checked');
}).each(function () {
    // Whatever you want here
});

Upvotes: 1

Related Questions