JSFiddle - React, Tailwind, and code Playground

HTML

<input class="box" type="checkbox">
<p class="red">Red text </p>

<input class="box" checked type="checkbox">
<p class="red">I want this text in blue </p>

CSS

.red{color:red;}

.blue {color:blue;}

JavaScript

if(jQuery(".box").is(":checked")) {
    jQuery(this).next().attr('class', 'blue');                              
}