JSFiddle - React, Tailwind, and code Playground

by sarathsprakash

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");
    }

});