JSFiddle - React, Tailwind, and code Playground

by digitalextremist

HTML

<input type="checkbox" value="checking"> <a href="#" class="open-box">Show next box</a>

<div class="box1"></div>

CSS

.open-box {
    display:none;
}
.box1 {
    background-color:red;
    width:200px;
    height:100px;
    display:none;
}

JavaScript

$('input[type="checkbox"]').click(function () {
    if (this.checked) {
        $(".open-box").show();
    } else {
        $(".open-box").hide();
        $(".box1").hide();
    }
    //de alert( $(this).attr("value") );
});

$('.open-box').click(function () {
    $(".box1").slideToggle();
});