Reputation: 1102
I have a form, and when a user uploads a training document it will check the checkbox
$('#training_code_'+trainingCode).attr('checked','checked');
If the user deletes the training it will run this :
$('#training_code_'+trainingCode).removeAttr('checked');
HTML:
<input type="checkbox" value="1" name="training_code_1" id="training_code_1"
<? if(mysql_num_rows($result_waperd)>0) echo"checked"; ?> disabled="disabled"/>
I tried to:
Does anyone know why that happens?
Upvotes: 0
Views: 64
Reputation: 28528
For DOM properties like checked, disabled and readonly, the proper way to do this (as of JQuery 1.6) is to use prop.
$('#someid').prop('disabled', true);
so try (to check):
$('#training_code_'+trainingCode).prop('checked',true);
uncheck:
$('#training_code_'+trainingCode).prop('checked',false);
Upvotes: 1