lundi 7 mars 2016

Checkbox behaviour using jquery

I have 3 checkbox and I want the following behaviour.

  1. If I click in one checkbox, the others uncheck.
  2. If I click in a checkbox that is checked, nothing happens.

I have this in jQuery:

('input.checkboxClassName').on('click', function() {
    $('input.checkboxClassName').not(this).prop('checked', false);
});

I get #1, but not #2. Any ideas? Thanks a lot.




Aucun commentaire:

Enregistrer un commentaire