jQuery blockUI 取消选中所有选中的复选框
我正在使用 ASP.NET 复选框列表控件。在页面上我有一个超链接。单击 blockUI 插件时,会显示一个包含复选框列表控件的 div。
再次调用 blockUI 时,复选框的状态始终处于未选中状态。即使之前在页面上选中了复选框,它们也始终处于未选中状态。
$("#multipleIA a:contains('multiple IA')").click(function () {
if($("#IACodes select option").size() > 0)
{
$.blockUI({
message: $('#chkgrpIA'),
css: { width:'240px', cursor: 'auto', backgroundColor: '#F2F2F2' }
});
$('.blockOverlay').click($.unblockUI);
}
});
$('#btnDone').click($.unblockUI);
I am using ASP.NET checkboxlist control. On the page I have a hyperlink. On its click blockUI plugin displayes a div which contains the checkbox list control.
The state of the checkboxes is always unchecked on calling blockUI again. The checkboxes are always unchecked evenif they were checked before on the page.
$("#multipleIA a:contains('multiple IA')").click(function () {
if($("#IACodes select option").size() > 0)
{
$.blockUI({
message: $('#chkgrpIA'),
css: { width:'240px', cursor: 'auto', backgroundColor: '#F2F2F2' }
});
$('.blockOverlay').click($.unblockUI);
}
});
$('#btnDone').click($.unblockUI);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过一些研究并尝试其他 jQuery 插件后,我发现了这个问题。要创建模式弹出窗口,必须禁用后台内容事件。因此,复选框的更改不会保存在 dom 中。
Simplemodal、BlockUI 和 jQuery UI Dialog 不会保留模式窗口调用之间的复选框更改。
一种解决方案是使用 jQuery cookie 插件手动保存更改。 模态框+复选框+cookie
另外以非模态方式打开对话框似乎效果很好。
After some research and trying other jQuery plugings I found the problem. To create the modal popup the background content events are disabled. Due to which the checkbox changes are not saved in the dom.
Simplemodal, BlockUI and jQuery UI Dialog do not persist the checkbox changes between modal window calls.
One solution is to use the jQuery cookie plugin to manually save the changes. Modal box + checkbox + cookie
Also opening the dialog in a non modal fashion seems to work pretty well.