单击 JS 对话框中的 "Check All" 按钮 window 会导致选中主页中的所有复选框

Clicking "Check All" button in a JS dialog window results in all checkboxes in the main page being checked

单击主页上的按钮添加 sku 会打开一个新的 window,其中包含如下图所示的搜索字段。此弹出窗口有一个“全部选中”按钮,单击该按钮后 select 弹出窗口 window 和主页上的所有复选框都会出现。我不知道为什么它 select 主要是那些而不是 select 弹出窗口中的那些 window。

下面是 select 复选框的代码。

    self.element.dialog({
        bgiframe: true,
        height: 600,
        width: 838,
        modal: true,
        autoOpen: false,
        resizable: true,
        closeOnEscape: true,
        title: "Add skus",
        buttons: {
            Cancel: function() {
                $(this).dialog('close');
            },
            'Add Skus': function() {
                self._save();
                $(this).dialog('close');
            },
            'Check all' : function(){
                $(':checkbox').attr('checked', true);
            }
        }
    });

试试这个语句:

$(':checkbox', this).attr('checked', true);

这会将上下文(在本例中为对话框)添加到选择器。