Contact Form 7 checkbox to add a new class to a div [closed]

After trying a few more ideas I found the one that did the trick. So if anyone else is looking for something similar, here’s what worked for me:

$(function() {
    $('.checkbox').click(function() {
        if ($(':checked', this).length > 0) {
            $(this).addClass('selected');
        } else {
            $(this).removeClass('selected');
        }
    });
});