Command disabled: index


̃Gg[͂ĂȃubN}[Nɒlj

jQuery :: チェックボックス:すべて選択・解除



<script type="text/javascript" src="/path/to/jquery.js"></script>
<script type="text/javascript">
    $(function(){
        $("#toggle").click(function(){
            $('.chkbox').attr('checked', $(this).attr('checked'));
        });
    });
</script>
 
<input type="checkbox" id="toggle"> toggle<br>
<br>
<input class="chkbox" type="checkbox" name="ids[]" value="1"> 1<br>
<input class="chkbox" type="checkbox" name="ids[]" value="2"> 2<br>
<input class="chkbox" type="checkbox" name="ids[]" value="3"> 3<br>

デモ

toggle

1
2
3









コメント (ご自由にお書きください)

Indy, 2011/10/16 10:29
You get a lot of respect from me for witring these helpful articles.
Enter your comment
 
programming/javascript/jquery/checkbox_toggle.txt