JSFiddle - React, Tailwind, and code Playground

by Tushar Jadhav

HTML

<label>
    <input type="checkbox" id="postageyes" name="postage1" value="Yes" />Yes</label>
<div id="conditional1">
    <p>This should only show when the 'Yes' checkbox &lt;input&gt; element is checked.</p> <a href="">close</a>

</div>

CSS

#conditional1 {
    display: none;
}

JavaScript

$('#postageyes').on('change', function () {
    $('#conditional1').toggle($(this).is(':checked'));
});

$('#conditional1').on('click', 'a', function() {
    $('#postageyes').prop('checked', false);
    $('#conditional1').hide();
    return false;
});