Result jQuery//チェックが入ってるのは背景色追加 $(":checked").parent().css("background","#f3f365"); //クリックイベント発火 $("input").click(function(e) { var t = e.target.type; var chk = $(this).prop('checked'); var name = $(this).attr('name'); チェックが入ったか入ってないかで条件分岐 if(t == 'checkbox') { if(chk == true){ $(this).parent().css('background', '#f3f365'); } else { $(this).parent().css('background-color', ''); } return true; //ラジ
![チェックしたチェックボックスの背景の色を変更する](https://cdn-ak-scissors.b.st-hatena.com/image/square/b6b1c87ada2ad66409793e3653c810e333009609/height=288;version=1;width=512/http%3A%2F%2Fkachibito.net%2Fwp-content%2Fuploads%2F2019%2F12%2Fsite-icon.png)