You're missing your return statement in this revised version (for the
noob's: which is needed to cancel the event)

-js


On 7/10/07, Sean Catchpole <[EMAIL PROTECTED]> wrote:

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

Reply via email to