0
我想創建一個腳本,將保存勾號複選框。我現在使用的代碼會禁用添加&,如果勾選了任何添加/批准,則禁止讀取。現在我遇到的問題是,當我向jquery添加ajax提交時,它不保存記錄,並且不再禁用複選框(假設我選中了讀取)。複選框保存在交換功能
這是我到目前爲止。
$(document).ready(function(){
$('#list-tbl tr').each(function(){
var $this = $(this);
var id = $('#input').val();
$('input[type=checkbox]', $this).change(function(){
if($('.read', $this).is(':checked')){
$('input[type=checkbox]', $this).prop('disabled',true);
$.ajax({
type: 'POST',
url: <?= site_url('admin/update')?>,
dataType: "json",
data: { id: id },
success: function(data) {
alert("Updated");
}
});
$(this).prop('disabled',false);
} else if($('.add', $this).is(':checked') || $('.approve', $this).is(':checked')) {
$('.read', $this).prop('disabled', true);
$(this).prop('disabled', false);
} else{
$('input[type=checkbox]', $this).prop('disabled',false);
$(this).prop('disabled',false);
}
});
});
});
我得到一個可愛的有點沮喪我只是想將數據保存在正確的方式和它是執行禁用....
非常感謝。
從我們的角度來看,很難確定您的問題實際是什麼。你會考慮用隨附的HTML製作一個[jsFiddle](http://jsfiddle.net/)嗎? – 2012-02-14 22:43:13
新增jsFiddle .. – 2012-02-14 23:03:32