As you the code below, my checkbox is like button. I want to make it only one is checkable. For now, Checkbox button change color when is clicked and all buttons are checkable at the same time.
PS. I want to make my checkbox button only is checkable with same effect now(when user click the button
$('label.btn').on('click','input', function(){
e.stopPropagation();
$(this).attr('checked', !$(this).attr('checked'));
$(e.target).closest('label').toggleClass('btn-flat');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-4">
<label class="btn btn-primary btn-block">
<input type="checkbox" name="Categories" value="1" /> check1 </label>
</div>
<div class="col-4">
<label class="btn btn-primary btn-block">
<input type="checkbox" name="Categories" value="1" /> check1 </label>
</div>
Please help me to solve this simple question. Thank you