lundi 7 novembre 2016

Checkbox acting like radio button | Using icheck.js

I have created three checkboxes as follows:

<input type="checkbox" name="upgrade">
<input type="checkbox" name="upgrade">
<input type="checkbox" name="upgrade">

I want these checkboxes to act like radio buttons and using the following jQuery, I am nearly achieving this. I am also using the icheck.js library, so I am doing the jQuery code like this:

$('input[type="checkbox"]').on('ifChanged', function() {
        $('input[name="' + this.name + '"]').not(this).iCheck('uncheck');
});

However this is only working with the first change, as soon as I click the third time it doesn't work any longer. Can anyone tell me what I am doing wrong ?




Aucun commentaire:

Enregistrer un commentaire