jqueryすべて選択一括削除なし
すべてを選択ボタンを選択し、一括削除をクリックします.
全選択
全選択
$(function() {
//
$("#theadInp").on('click', function() {
$("tbody input:checkbox").prop("checked", $(this).prop('checked'));
})
$("tbody input:checkbox").on('click', function() {
// checkbox , checkbox ,
if($("tbody input:checkbox").length === $("tbody input:checked").length) {
$("#theadInp").prop("checked", true);
} else {
$("#theadInp").prop("checked", false);
}
})
})
function datadel(){
$ids = $("input[name='ids']:checked");
var id=[];
$("input[name='ids']:checked").each(function(i){
id[i] = $(this).val();
});
// 。
if(id.length == 0){
return;
}
layer.confirm(' ?',function(index){
$.ajax({
type: 'POST',
url: "{
{:MyUrl('admin/goods/delall')}}",
data:{id:id},
dataType: 'json',
success: function(data){
$ids.each(function(i){
$(this).parents("tr").remove();
});
layer.msg(' !',{icon:1,time:500});
},
error:function(data) {
console.log(data.msg);
},
});
});
}