It sounds like it's your selector that's incorrect. Could you post how your HTML looks like?
On Aug 26, 9:42 am, Brett DeWoody <brettdewo...@gmail.com> wrote: > I have a function which is executed whenever someone clicks a checkbox > on the page. There are lots of checkboxes on the page. I want the > function to be performed on only the unchecked boxes. I've tried this > two ways, neither of which has worked. Here are the two methods I've > tried. > > Method #1 > $(".item input:unchecked").each( > function() { > if ($(this).val() > diff) { > $(this).attr('disabled', true); > } else { > $(this).removeAttr('disabled'); > } > } > ); > > Method #2 > $(".item input").each( > function() { > if ($(this).is(":unchecked")) { > if ($(this).val() > diff) { > $(this).attr('disabled', true); > } else { > $(this).removeAttr('disabled'); > } > } > } > ); > > Where diff is an integer and the values of the checkboxes are all > integers. The problem is the function ends up getting run on all > checkboxes, even boxes that have been checked. > > Is there another way to do this? Something I'm missing. > > Thanks, > > -Brett