I would like to find a way on how to link bootstrap button classes in the following manner?
<!-- HTML -->
<div class="col-md-6 col-sm-6">
<label class="btn btn-primary">
<input type="checkbox">
<i class="flaticon-groceries"></i>
<span>Grocery</span>
<a>select</a>
</label>
</div>
<div class="col-md-6 col-sm-6">
<label class="btn btn-primary">
<input type="checkbox">
<i class="flaticon-cooking"></i>
<span>Cooking</span>
<a>select</a>
</label>
</div>
<div class="col-md-6 col-sm-6">
<label class="">
<input type="checkbox">
<i class="flaticon-house-cleaning"></i>
<span>Cleaning</span>
<a>select</a>
</label>
</div>
<div class="col-md-6 col-sm-6>
<label class="">
<input type="checkbox" ng-model="mySelfHandyman" >
<i class="flaticon-handyman-1"></i>
<span>Handyman</span>
<a>select</a>
</label>
</div>
<!-- jquery -->
$('input[type="checkbox"]).on('change',function(){
$('input[type="checkbox"]').not(this).prop('checked', false);
});
using input as radio type is not an option. they have to be checkbox. Results that are desired is that when checkbox = true, button (label in this case) should be active and when we select a different checkbox previous button should got to its default state and the current one should be active. Situation also call for only 1 checkbox to be selected at one time. jquery is in place to solve that problem, but I am unable to toggle the buttons between default and active states on checkbox clicks. Currently I have to click on the buttons twice to remove the active class. First click makes the checkbox = true and button class=active, if i click on second checkbox, it makes previous checkbox = false and (this) = true, but it also makes the current button class=active without changing the previous button's class to default. I would really appreciate any help in this matter. Thanks