samedi 23 janvier 2016

Mutually Exclusive Bootstrap Checkbox Switches

I have this JSFiddle with two checkboxes using Bootstrap Switch. I would like them to be mutually exclusive, i.e neither of them can be on or off at the same time. Is this possible without using the radio button class?

Current checkbox code as per below:

$("[name='my-checkbox']").bootstrapSwitch({
onSwitchChange: function (event, state) {

    if(state) map.addLayer(streetsTile);
    else map.removeLayer(streetsTile);
}
});

$("[name='my-checkbox2']").bootstrapSwitch({
onSwitchChange: function (event, state) {

    if(state) map.addLayer(exampleTile);
    else map.removeLayer(exampleTile);
}




Aucun commentaire:

Enregistrer un commentaire