JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<form action="#" method="post">
    <fieldset>
        <label for="checkboxID">Toggle the divs</label>
        <input type="checkbox" id="checkboxID" />
    </fieldset>
</form>
<div id="div1">This is the first div</div>
<div id="div2">This is the second div</div>

CSS

#div1 {
    display: none;
}

JavaScript

$('#checkboxID').click(
    function(){
        $('#div1, #div2').toggle();
    });