Javascript 检查是否在jquery数据表中选中了所有单选按钮
我有一个数据表,我想检查是否所有单选按钮都被选中,但这只适用于第一个分页页面,但无法检查其他页面 这是我的代码:Javascript 检查是否在jquery数据表中选中了所有单选按钮,javascript,jquery,datatables,Javascript,Jquery,Datatables,我有一个数据表,我想检查是否所有单选按钮都被选中,但这只适用于第一个分页页面,但无法检查其他页面 这是我的代码: var dt = $('#newtable').DataTable({ "paging": true, "lengthChange": false, "searching": false, "ordering": true, "info": true, "auto
var dt = $('#newtable').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false
});
这是我用来检查的
$("input:radio").change(function() {
var all_answered = true;
dt.rows().nodes().each(function() {
if($(":radio:checked").length == 0)
{
all_answered = false;
}
})
if(all_answered==true ){
$('input[type=text]#general_comment').removeAttr("disabled");
approvebtn.removeAttr("disabled");
}else {
approvebtn.prop("disabled", "disabled");
}
});
初始化数据表后,您可以
bind
在DataTable
上绑定page
事件,分页时(页面更改)将检查您想要的内容
$('#newtable').bind('page', function () {
//call to check what you want.
});
你知道那不是单选按钮的作用,对吧?单选按钮用于“选择其中一个选项”问题。因此,它们不能全部被检查