Datatables事件

DataTables格式化渲染加上的html代码按一般方式绑定事件可能会没效果,通过以下方式可以解决

1 $(document).on("click","#checkchild",function(){
2         var check = $(this).prop("checked");
3         if(check && check==true){
4             $(this).prop("checked",false);
5         }else{
6             $(this).prop("checked",true);
7         }
8         checkButton();
9     });

 选中行事件

 1 $("#mytable tbody").on("click","tr",function(){
 2         var check = $(this).find(".checkchild").prop("checked");
 3         if(check && check==true){
 4             $(this).find('.checkchild').prop("checked",false);
 5         }else{
 6             $(this).find('.checkchild').prop("checked",true);
 7         }
 8         checkButton();
 9         
10     });
原文地址:https://www.cnblogs.com/suruozhong/p/6256435.html