CheckBox To Behave Like RadioButton
HTML
<h3>Uncheckable RadioButtons</h3>
<div class="checkbox-wrapper">
<label><input type="checkbox" name="cb1" class="chb" /> CheckBox1</label>
<label><input type="checkbox" name="cb2" class="chb" /> CheckBox2</label>
<label><input type="checkbox" name="cb3" class="chb" /> CheckBox3</label>
<label><input type="checkbox" name="cb4" class="chb" /> CheckBox4</label>
</div>
JavaScript
function CheckBoxToRadio(selectorOfCheckBox, isUncheckable) {
$(selectorOfCheckBox).each(function()
{
$(this).change(function()
{
var isCheckedThis = $(this).prop('checked');
$(selectorOfCheckBox).prop('checked',false);
if (isCheckedThis === true) {
$(this).prop('checked', true);
}
});
});
}
CheckBoxToRadio(".checkbox-wrapper .chb");