Seriously i have tried everything that i could think of but i still cant find a way how to uncheck the checkbox once popping up the alert.
var sessionvar;
$.ajaxSetup({cache: false})
$.get('test.php' ,function (data) {
sessionvar = data;
alert(sessionvar);
if(checked){
if(sessionvar > 2){
alert('You only allowed to select maximum 3');
setsession(sBorrowValue, "UNSET");
$(this).attr('checked', false);
}
else{
setsession(sBorrowValue, "SET");
}
}
else{
setsession(sBorrowValue, "UNSET");
}
});
I want to uncheck the checkbox after the alert('You only allowed to select maximum 3');
but not working. i also tried using this.checked = false
, $(this).attr('checked', false);
, $(this).prop('checked', false);
but still its not uncheck the checkbox.
NOTE: this.checked = false
works when outside from ajax. but when i put it on the inside, its not working.
Aucun commentaire:
Enregistrer un commentaire