mercredi 25 mai 2016

Why can I not uncheck my CheckBox?

I have three CheckBoxes as below and my problem is that once I have checked the bottom checkbox (cbOnlyUK) I can not then uncheck it. I am unsure why this is the case or how to resolve it so any help is appreciated.

<input type="checkbox" runat="server" id="cbNonUK"/>Non-UK<br />
<input type="checkbox" runat="server" id="cbNonEU"/>Non-EU<br />
<input type="checkbox" runat="server" id="cbOnlyUK" onchange="onlyUK()"/>UK Only

cbOnlyUK has the following Javascript code attached to it:

function onlyUK() { 
    if (document.getElementById("<%= cbOnlyUK.ClientID %>").checked = true)
    {
        document.getElementById("<%= cbNonUK.ClientID %>").checked = false;
        document.getElementById("<%= cbNonEU.ClientID %>").checked = false;
        document.getElementById("<%= cbOnlyEU.ClientID %>").checked = false;
    }
}

Thanks.




Aucun commentaire:

Enregistrer un commentaire