小编mmt*_*mmt的帖子

Jquery上的Fire事件检查/取消选中

我想根据checkbox click/unclick事件设置一个变量(pageselected).

HTML代码是:

<thead>
    <tr id="othercheckbox">
        <th width="10"><input type="checkbox" name="zip" class="all"  value="all" /></th>              
    </tr>
</thead>
Run Code Online (Sandbox Code Playgroud)

JS文件中的代码是:

$('#othercheckbox').click(function() {

    if($(this).is(':checked')){
        console.log("CCCCheckeddddddd");
        that.pageselected = true;
    }
    else
    {
        console.log("UNCheckeddddddd");
        that.pageselected = false;
    }
}
Run Code Online (Sandbox Code Playgroud)

但这并不像预期的那样.我哪里错了?

checkbox jquery checked

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

checkbox ×1

checked ×1

jquery ×1