Cannot retain checkbox value using jquery.cookie

元气小坏坏 提交于 2019-12-01 14:12:02

There is no reason to use $.cookie in your case. In the checkbox change event, you can simply store the value of the checked state and use that to set the checked property of the new checkbox generated when you reload the table

var isChecked;
$(document).on('change', '#cbIsAll', function () {
    // Store the current value
    isChecked = $(this).is(':checked');
    ....

Then in the datatable's callback function, set the checked state of the checkbox

$('#cbIsAll').prop('checked', isChecked);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!