JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" id="test">
<label for="test">text</label>
JavaScript
$("#test").click(function () {
if ($(this).is(":checked")) {
$(this).next().fadeOut("slow", function () {
$("#test").next().text("hi");
}).fadeIn("slow");
} else {
$(this).next().fadeOut("slow", function () {
$("#test").next().text("text");
}).fadeIn("slow");
}
});