Why add the class "disabled" Sean? _____
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sean Catchpole Sent: Tuesday, July 10, 2007 4:19 PM To: jquery-en@googlegroups.com Subject: [jQuery] Fwd: [jQuery] Re: allow no more than 3 checkboxes checked On 7/10/07, cfdvlpr <[EMAIL PROTECTED]> wrote: > That works very well. Could you also grey out the unchecked > checkboxes after 3 are checked? $.fn.limit = function(n) { var self = this; this.click(function(){ (self.filter(":checked").length==n)? self.not(":checked").attr("disabled",true).addClass("disabled"): self.not(":checked").attr("disabled",false).removeClass("disabled"); }); } $("input:checkbox").limit(3); ~Sean