in the following snippet, I want (from a group of checkboxes) to disable the correspondent check button:
var leftradios = "input[name='ctl00$ContentPlaionCode1']";
var rightradios = "input[name='ctlC1$rblPositionCodfde2']";
for (i=0;i<5;i++) {
if ($(leftradios)[i].checked) {
$(rightradios)[i].prop('disabled', true); //<--- this should be the culprit
}
What is wrong with the last line? Thank you.
replace it with
$(rightradios).eq(i).prop('disabled', true);
square brackets accesses the array like object and gets the native DOM node, not the jQuery object, and the native DOM node has no prop
method.
Another option would be
$(rightradios)[i].disabled = true;