I am trying to use several asp.net flags on a page, disabling them accordingly.
<asp:CheckBox ID='chkMenuItem' runat='server' CssClass='HiddenText' Text='Test' onclick='<%#String.Format("checkChild({0});", Eval("id")) %>' />
in javascript, I use the following code
function checkChild(id) {
for (i = 0; i < $("input[id*=hdnParentMenuItemID]").length; i++) {
if ($('input[id*=hdnParentMenuItemID]')[i].value.split(':')[0] == id) {
var childID = $('input[id*=hdnParentMenuItemID]')[i].value.split(':')[1];
if ($("#" + childID).attr("disabled"))
$("#" + childID).removeAttr("disabled");
else
$("#" + childID).attr('disabled', true);
}
}
}
Now the checkboxes are disabled after the page loads, the removeAttr section does not work. I tried going through the debugger and the logic works fine. If the checkboxes are not disabled when the page loads, the code works fine. I tried replacing the disabled attributes with 'checked' to see if other attributes worked, and it worked fine. I tried
$("#" + childID).attr('disabled', '');
but he didnโt work either.
Note. It works fine on FF and Chrome, but doesn't work on IE.
Thanks,
source
share