JSFiddle - React, Tailwind, and code Playground

HTML

<input id="101" type="checkbox" name="q1" value="aaa"><label for="101">category A</label><br />
<input id="102" type="checkbox" name="q1" value="bbb"><label for="102">category B</label><br />
<input id="103" type="checkbox" name="q1" value="ccc"><label for="103">category C</label><br />
        
<div id="question2" class="question">
    <p>Results:</p>
    <ul id="q2"></ul>
</div>

JavaScript

$(function () {
    $('input[name=q1]').on('change', function () {

        var valu = $(this).val();

        if ($(this).is(':checked')) {
            $('#q2').append("<li><a href='#'>" + valu + "</a></li>");
            $('#question2').show();
        } else {
            var lis = $("#q2").find('li');
            lis.each(function () {
                if ($(this).text() === valu) {
                    $(this).remove();
                }
            });

            if (lis.length === 0) {
                $('#question2').hide();
            }
        }
    });
});