Hi Brett, this should do it. $(':checkbox').each(function() { this.disabled = +this.value > diff; });
:-) --Karl ____________ Karl Swedberg www.englishrules.com www.learningjquery.com On Aug 26, 2009, at 3:42 PM, Brett DeWoody 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