日期:2014-05-16  浏览次数:20414 次

如图 我想让禁用的checkbox我按全选他也是不勾选的。。
本帖最后由 aaa8562373 于 2014-03-19 10:40:05 编辑


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


咋写啊。。~~~
------解决方案--------------------
<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>