JSFiddle - React, Tailwind, and code Playground

by karim79

HTML

<label for="termsCheckbox">Hello </label><input type="checkbox" id="termsCheckbox"/>

CSS

.terms_error { background-color:#00FF00; }

JavaScript

$("#termsCheckbox").change(function() {
    // class will be removed if checked="checked"
    // otherwise will be added
    $('label').toggleClass("terms_error", !this.checked);
}).change(); // set initial state