How to add class to div based on radio button selected in it?

You can do this with pure CSS, no need for JS (if styling is your only aim)

CSS:

input[type=checkbox]:checked ~ div {
    some styles....
}

Ideally you will use class names and not tag names for the above.

Leave a Comment