Exclusive CheckBoxList

Make a CheckBoxList Mutually Exclusive

HTML

<input id="ctl00_phContent_rblAddRemoveCoveragePermanent_Med2200_0"
                   name="ctl00$phContent$rblAddRemoveCoveragePermanent_Med2200$0" value="A" type="checkbox" />
            <label for="ctl00_phContent_rblAddRemoveCoveragePermanent_Med2200_0">Add</label>
            <input id="ctl00_phContent_rblAddRemoveCoveragePermanent_Med2200_1"
                   name="ctl00$phContent$rblAddRemoveCoveragePermanent_Med2200$1" value="R" type="checkbox">
            <label for="ctl00_phContent_rblAddRemoveCoveragePermanent_Med2200_1">Remove</label>

JavaScript

//function MakeCheckBoxListMutuallyExclusive() {

// Get all the checkboxes
var checkBoxes = $("span.cblAddRemove input:checkbox");

// Add a click hander to each checkbox
checkBoxes.click(function() {
    // Get the id of the selected checkbox
    var selectedId = this.id;

    // Get the parent id of the selected control.  This is needed 
    // because the same class is assigned to multiple checkboxlist 
    // controls and we only want the selected one impacted.
    var parentId = $("#" + selectedId).parent().attr("id")

    // Uncheck all the other checkboxes with the same parentId
    // The selected checkbox will auto-toggle
    checkBoxes.each(function() {
        if (parentId == $(this).parent().attr("id") && this.id != selectedId) 
            this.checked = false;
    });
    });

//}