迭代复选框,如果选中任何复选框,则取消选中id =" All"复选框。 [英] iterate checkboxes and if any checkbox is checked ,uncheck the checkbox with id="All"

查看:98
本文介绍了迭代复选框,如果选中任何复选框,则取消选中id =" All"复选框。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的HTML



My HTML

<input id="Alloption" type="checkbox"  checked="checked" value="All" style=" color: Black" class="chkdisplay"/><span style=" color: Black" >All </span><br />
                               <input id="Checkbox2" type="checkbox"  value="Accepted"  style=" color: Black"  class="chkdisplay" /><span style=" color: Black" >Accepted </span><br />
                               <input id="Checkbox3" type="checkbox" value="Contracted" style=" color: Black" class="chkdisplay"/><span style=" color: Black" >Contracted</span><br />
                               <input id="Checkbox4" type="checkbox"  value="Pending" style=" color: Black" class="chkdisplay"/><span style=" color: Black" >Pending</span><br />
                               <input id="Checkbox5" type="checkbox"  value="Pre-Authorized" style=" color: Black" class="chkdisplay"/><span style=" color: Black" >Pre-Authorized</span><br />
                               <input id="Checkbox6" type="checkbox"  value="Show Deleted" style=" color: Black" class="chkdisplay"/><span style=" color: Black" >Show Deleted</span><br />
                               <input id="Checkbox7" type="checkbox"  value="Treated" style=" color: Black" class="chkdisplay"/><span style=" color: Black" >Treated</span><br />





我使用的脚本(不工作)

$(''。chkdisplay'')。on(''blur blur'',function(){

$(''#Alloption'')。prop('''','($(''。chkdisplay'')。not('':checked'')。length));

});



我想重复从1到7的复选框,如果选中此复选框,则取消选中id =所有



Script i used(not working)
$(''.chkdisplay'').on(''change blur'', function () {
$(''#Alloption'').prop(''checked'', !($(''.chkdisplay'').not('':checked'').length));
});

I want to iterate the checkboxes from 1 to 7 and if any of this checkbox is checked the uncheck checkbox with id="All"

推荐答案

(''。chkdisplay'')。on(''change blur'',function(){
(''.chkdisplay'').on(''change blur'', function () {


(''#Alloption'')。prop(''checked'',!(
(''#Alloption'').prop(''checked'', !(


(''。chkdisplay'')。not('':选中'')。长度));

});



我想重复从1到7的复选框,如果有的话选中此复选框,取消选中id =All的复选框
(''.chkdisplay'').not('':checked'').length));
});

I want to iterate the checkboxes from 1 to 7 and if any of this checkbox is checked the uncheck checkbox with id="All"


这篇关于迭代复选框,如果选中任何复选框,则取消选中id =&quot; All&quot;复选框。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆