html标记要运行的AD效果javascript

html标记要运行的AD效果javascript,javascript,jquery,html,checkbox,Javascript,Jquery,Html,Checkbox,我有一张桌子。thead中的项目包含一个复选框。如果我单击复选框“selectAll”,它将选中表中的所有复选框。我必须添加jquery表排序器。为此,我不得不使用thead。我的javascript因为thead而停止工作。如果我删除了AD,它可以正常工作,单击该复选框将选中表中的所有其他复选框 我的html是: <thead> <tr> <th id="idCheckBox"><input type="checkbox" id="selectAll"

我有一张桌子。thead中的项目包含一个复选框。如果我单击复选框“selectAll”,它将选中表中的所有复选框。我必须添加jquery表排序器。为此,我不得不使用
thead
。我的javascript因为thead而停止工作。如果我删除了AD,它可以正常工作,单击该复选框将选中表中的所有其他复选框

我的html是:

<thead>
<tr>
<th id="idCheckBox"><input type="checkbox" id="selectAll"/> All</th>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<th id="idEsc">Column 4</th>
<th>Column 5</th>
<th id="idComments">Column 6</th>
<th id="idSuspend">Column 7</th>
</tr>
</thead>
<th id="idCheckBox"><input type="checkbox" id="selectAll" onclick="selectCheckBoxes()"/> All</th>
有没有大师需要帮助


干杯

我不认为这是因为
thead
。用于设置选中的特性值

$(function () {
    // add multiple select / deselect functionality
    $("#selectAll").click(function () {
        $cases.prop('checked', this.checked);
    });

    var $cases = $(".case").click(function () {
        $("#selectAll").prop("checked", $cases.not(':checked').length == 0);
    });
});

演示:

我通过在javascript中添加函数名并在复选框的
onclick
event上调用它,解决了这个问题

我的html是:

<thead>
<tr>
<th id="idCheckBox"><input type="checkbox" id="selectAll"/> All</th>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<th id="idEsc">Column 4</th>
<th>Column 5</th>
<th id="idComments">Column 6</th>
<th id="idSuspend">Column 7</th>
</tr>
</thead>
<th id="idCheckBox"><input type="checkbox" id="selectAll" onclick="selectCheckBoxes()"/> All</th>

请看,我不认为这是因为
thead
,请使用
.prop()
设置选中的属性。那么使用的jQuery版本是什么“我的javascript因为thead而停止工作”。控制台中是否出现错误?它是jQuery-1.8.1.min.js。我在控制台中看到这样的消息“[15:41:26.371]不推荐使用getPreventDefault()。请改用defaultPrevented。”@Kinghan您是否检查了我给出的解决方案。。。它起作用了吗