チェックボックスを無効にする ajax 呼び出しがあり、ajax が終了したら再度有効にしたいと考えています。ただし、後で無効にした属性を削除することはできません。
$(function(){ // added
$("input:checkbox").live("click", function(){
var a_href = $(this).attr('id');
var checked = $(this).attr('checked');
if (checked == 'checked') {
checked = 1;
}else {
checked = 0
};
$(this).parent().parent().after('<img class="loader" style="padding-botton:0 !important;" alt="" src="images/loaders/loader.gif">');
$(this).attr('disabled','disabled');
$.ajax( {
type: "POST",
url: "includes/featured.php",
data: { id: a_href, value: checked, field: "main_feature" },
success: function(data) {
$('img.loader').fadeOut('slow',function(){$(this).remove()});
$(this).removeAttr('disabled');
}
}).done(function (data){
}
);
return false;
});
}); // added
私も試しました:
.attr('disabled', false);