JSFiddle - React, Tailwind, and code Playground

HTML

<form class="fullboxform">
    <input type="checkbox" id="detailssame" />
    <input type="text" required />
</form>

JavaScript

$(function () {
    $('#detailssame').click(function() {
        var checked = $(this).is(':checked');
        if(checked) {
            $("#detailssamehide").hide();
        } else {
            $("#detailssamehide").show();
        }     
        $('.fullboxform input[type=text], .fullboxform select').each(function() {
            $(this).prop('required', !checked);
        });
    });
});