JSFiddle - React, Tailwind, and code Playground

by riturajratan

HTML

<input type="checkbox" id="test"> <label for="test">text</label>

JavaScript

$("#test").click(function(){

if($(this).is(":checked"))
{
$(this).next().css('color','red');
}
else{

$(this).next().css('color','black');// your default color set
}

});