ググらずには前へ進めないフロントエンドエンジニアが書く、次はググらなくてもできますように…とメモを残すブログです!

チェックボックスをjQueryで一度にチェック!する。

2011/06/22
⚠️投稿日または最終更新日から11年以上経過している内容です。

導入 http://h2ham.seesaa.net/article/123196931.htm 参考 http://linker.in/journal/2011/04/mt-8.php

■チェックボックスの場合。

○選択

javascript
jQuery(function($) {
    $('div#show_fields-field').each(function(){
        $(this).find(':checkbox').attr('checked', 'checked');
    });
});

○解除

javascript
jQuery(function($) {
    $('div#show_fields-field').each(function(){
        $(this).find(':checkbox').attr("checked",false);
    });
});

上記両ブログ様ありがとうございます。感謝です。