我想要做的是我添加了两个默认禁用的按钮。当我添加一个项目时,一旦我单击收据按钮,这些按钮将启用,选中的复选框应该消失,这在我的笔记本电脑中工作但不在小提琴中,如果我单击收据,如果 removeAttr 选中复选框并且按钮应该禁用,因为没有选中复选框。这是我的代码JSFIDDLE
Javascript:
// json data object
var data = JSON.parse('{ "122233334444": ["Book","Three Musketters","DE7598490587","7584092043857", "03/18/13 11:17:51 AM","03/18/13 11:17:51 AM", "1" ], "122223355552":["eBook","Fall Colors","XYZ29494949","7584092043857", "03/18/13 11:17:51 AM","03/18/13 11:17:51 AM", "2" ], "122223355533":["eBook","Snowfall","XYZ29494949","7584092043857", "03/18/13 11:17:51 AM","03/18/13 11:17:51 AM", "3" ] }');
$("#submitid").click(function () {
$('#resend').removeAttr('disabled');
$('#receipt').removeAttr('disabled');
var rowId = $("#number").val();
$("#number").val("");
var rowData = data[rowId];
if (rowData) {
var tr = $("<tr><td><input id='item-id' type='checkbox' checked/></td></tr>").attr("id", "datatable-row-" + rowId);
for (var col = 0; col < rowData.length; col++)
tr.append($("<td></td>").text(rowData[col]));
$("#datatable").prepend(tr);
$("#datatable").show();
} else {
alert("Row doesn't exist in json object: " + rowId);
}
});
$('#receipt').click(function () {
$('#item-id').removeAttr('checked');
$('#resend').attr('disabled');
$('#receipt').attr('disabled');
});