不要直接修改checked属性  如果没选中click 多选框试试

解决方案 »

  1.   

    $('.test_class input[type=checkbox],#show_img').on('click',function(){
    ......
    });
      

  2.   

    跑foreach不行,值带不过去,var check判定也失效<?php foreach((array)$array as $arrays): ?>
    <ul>
    <li>
    <label>
    <input type="checkbox" id="<?php echo $arrays['id'];?>" value="<?php echo $arrays['id'];?>" > <a id="show_img<?php echo $arrays['id'];?>" style="text-decoration: none" 
    href="images/prod/<?php echo $arrays['img'];?>" 
    onclick="document.getElementById('<?php echo $arrays['id'];?>').checked=!document.getElementById('<?php echo $arrays['id'];?>').checked;return false;">
    <?php echo $arrays['name']?></a>
    </label>
    </li>
    <script>
    $(function() {
    $("#show_img<?php echo $arrays['id'];?>?>").powerFloat({
    targetMode: "ajax",
    targetAttr: "href",
    hoverFollow: "y",
    position: "2-1"
    });
    });$(function(){
        $('.test_class input[type=checkbox],#show_img<?php echo $arrays['id'];?>?>').on('click',function(){
            var check = ($(this).attr('checked')=='checked')?1:0;       
            if(check==1){
                add(); 
            }else{
                del(); 
            }
        });   
    })
    </script>
    </ul>
    <?php endforeach; ?>
      

  3.   

    var check = $(this).is(':checked')?1:0;
      

  4.   

    改var check = $(this).is(':checked')?1:0;,一样问题
      

  5.   


    $(function(){
        $('.test_class input[type=checkbox],#show_img').on('click',function(){
            $("#test_1").is(':checked')?add():del();
        });   
    })
      

  6.   

    $('#show_img').click(function(){
        document.getElementById('test_1').checked=!document.getElementById('test_1').checked;
        $('#test_1').change();
        return false;
    })
    html里面的oncllick去掉吧。通过JS修改选中checkbox的勾选状态是不会触发他的chang事件的
      

  7.   

    To : functionsub,还有一点问题,点point me勾选没反应,点连结外有反应
      

  8.   


    不是叫你把html里a标签的onclick拿掉吗?
      

  9.   


    不是叫你把html里a标签的onclick拿掉吗?
    有拿掉
      

  10.   


    不是叫你把html里a标签的onclick拿掉吗?
    有拿掉
    不知道你了,我这里测试正常。