My current challenge involves using JavaScript to disable checkboxes in a checkbox list. The code snippet I am working with looks like this:
var objItem = document.getElementById("<%= resCBL.ClientID %>");
var checkBoxes = objItem.getElementsByTagName("input");
if (form1.secTB.value == 0) {
checkBoxes[0].disabled = true;
While this code functions correctly, there is an issue when the page renders in Internet Explorer. The text attribute for the checkbox is rendered as a label, causing only the checkbox itself to appear greyed out rather than both the checkbox and its associated text.
If I set
Enabled = false
in the .aspx code behind, everything becomes greyed out. However, this makes it difficult (using my current method) to re-enable the checkbox and remove the greyed-out effect on the label.
I would appreciate any guidance on how to work around this issue and gain a better understanding of why it occurs.