如图 我想让禁用的checkbox我按全选他也是不勾选的。。

aaa8562373 2014-03-19 10:38:26


var box = $("input[type='checkbox']");
$('.chebox').each(function(){
$('.chebox').click(function(){
if(box.is(':disabled')){
box.attr('checked','true');
}
})
})


咋写啊。。~~~
...全文
330 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
嘻哈大咖秀 2014-03-19
  • 打赏
  • 举报
回复
$('.chebox').each(function(){
        $(this).click(function(){
             if($(this).prop('checked')){
                //$('.chebox').prop('checked',true);
                $(":checkbox").each(function(){
                    if(!$(this).is(':disabled')){
                     
                         $(this).prop('checked',true);
                     }
                })
                
             }else{
                $(":checkbox").each(function(){
                    
                     
                    $(this).prop('checked',false);
                     
                })
             }
            // if(!box.is(':disabled')){
            //     alert(1);
            //     box.prop('checked',true);
            // }
            
        })
    })
aaa8562373 2014-03-19
  • 打赏
  • 举报
回复
<div class='import_layout'> <!--导入进度--> <div class='progress'> <div class='fl back94c047 w34 progress_list'> <div class='green_head'></div> 1.上传导入文件 <div class='green_bottom_round'></div> </div> <div class='fl back94c047 w34 progress_list'> 2.确定导入信息 <div class='green_bottom'></div> </div> <div class='fl w32 progress_list'> 3.导入成功 <div class='grey_bottom_round'></div> </div> <div class='cl'></div> </div> <!--导入区域内容--> <div class='import_cont bs_item'> <div class='import_cont_title'>2.确定导入信息</div> <div class='import_view_title'><p>共导入20条信息,符合要求18条,不符合要求2条<span class='red'>(注:标注红色为不符合要求信息)</span></p></div> <div class='pL5'>系统已为导入数据匹配对应信息类别,如有问题,您可以自行调整</div> </div> <div class="import_view_cont"> <form action=''> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="promotion_list_title"> <tbody> <tr> <th width="10%"><input type='checkbox' class='chebox'>全选</th> <th width="10%">会员姓名</th> <th width="15%">手机号码</th> <th width="10%">性别</th> <th width="15%">身份证号</th> <th width="15%">电子邮箱</th> <th width='10%'>QQ</th> <th>会员积分</th> </tr> </tbody> </table> <div class='import_view_table'> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="promotion_list_table import_tabel"> <tbody> <tr> <td width="10%"><input type='checkbox' ></td> <td width="10%">李磊</td> <td width="15%">151648574846</td> <td width="10%">男</td> <td width='15%'>1234567851556165</td> <td width='15%'>1321231@163.com</td> <td width='10%'>4546546</td> <td>332</td> </tr> <tr class='red'> <td width="10%"><input type='checkbox' disabled="disabled" ></td> <td width="10%">李磊</td> <td width="15%">151648574846</td> <td width="10%">男</td> <td width='15%'>1234567851556165</td> <td width='15%'>1321231@163.com</td> <td width='10%'>4546546</td> <td>332</td> </tr> <tr> <td width="10%"><input type='checkbox' ></td> <td width="10%">李磊</td> <td width="15%">151648574846</td> <td width="10%">男</td> <td width='15%'>1234567851556165</td> <td width='15%'>1321231@163.com</td> <td width='10%'>4546546</td> <td>332</td> </tr> <tr> <td width="10%"><input type='checkbox' ></td> <td width="10%">李磊</td> <td width="15%">151648574846</td> <td width="10%">男</td> <td width='15%'>1234567851556165</td> <td width='15%'>1321231@163.com</td> <td width='10%'>4546546</td> <td>332</td> </tr> <tr> <td width="10%"><input type='checkbox' ></td> <td width="10%">李磊</td> <td width="15%">151648574846</td> <td width="10%">男</td> <td width='15%'>1234567851556165</td> <td width='15%'>1321231@163.com</td> <td width='10%'>4546546</td> <td>332</td> </tr> <tr> <td width="10%"><input type='checkbox' ></td> <td width="10%">李磊</td> <td width="15%">151648574846</td> <td width="10%">男</td> <td width='15%'>1234567851556165</td> <td width='15%'>1321231@163.com</td> <td width='10%'>4546546</td> <td>332</td> </tr> <tr> <td width="10%"><input type='checkbox' ></td> <td width="10%">李磊</td> <td width="15%">151648574846</td> <td width="10%">男</td> <td width='15%'>1234567851556165</td> <td width='15%'>1321231@163.com</td> <td width='10%'>4546546</td> <td>332</td> </tr> <tr> <td width="10%"><input type='checkbox' ></td> <td width="10%">李磊</td> <td width="15%">151648574846</td> <td width="10%">男</td> <td width='15%'>1234567851556165</td> <td width='15%'>1321231@163.com</td> <td width='10%'>4546546</td> <td>332</td> </tr> </tbody> </table> </from> </div> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="promotion_list_title" style='border:none'> <tbody> <tr> <th width="10%"><input type='checkbox' class='chebox' checked = 'checked'>全选</th> <th width='90%'></th> </tr> </tbody> </table> </div> <div class='pT62 but_w'> <input type='submit' value = '导入' class='but_4174b4 fl marginR50'> <input type='button' value = '上一步' class='but_7baae5 fl'> <div class='cl'></div> </div> </div> <script type="text/javascript"> $(document).ready(function(){ //checkbox的选择 var box = $("input[type='checkbox']"); $('.chebox').each(function(){ $('.chebox').click(function(){ if(!box.is(':disabled')){ alert(1); box.prop('checked',true); } }) }) }); </script> 无效
嘻哈大咖秀 2014-03-19
  • 打赏
  • 举报
回复
<html>
<head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0-beta1.js"></script>
</head>

<body>
 <input type="checkbox" class="chebox" /><input type="checkbox" class="chebox" disabled /><input type="checkbox" class="chebox" /><input type="checkbox" class="chebox" /><input type="checkbox" class="chebox" /><input type="checkbox" class="chebox" />

 <script type="text/javascript">

    $(function(){ 
        //console.log($(".check"))
        $(".chebox").each(function(){
            
            if(!$(this).is(':disabled')){
                $(this).prop('checked',true);
            }
        })
    })
    
</script>
</body>
</html>
aaa8562373 2014-03-19
  • 打赏
  • 举报
回复
嘻哈大咖秀 2014-03-19
  • 打赏
  • 举报
回复
引用 5 楼 aaa8562373 的回复:
谢谢你啊~,非常感谢,这个prop如果元素当前没设置这个属性是不是也可以获取~
没设置是取不到的 只能是有什么取什么
aaa8562373 2014-03-19
  • 打赏
  • 举报
回复
谢谢你啊~,非常感谢,这个prop如果元素当前没设置这个属性是不是也可以获取~

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧