JSFiddle - React, Tailwind, and code Playground

HTML

<span class="wpcf7-form-control-wrap sameAddress">
    <span class="wpcf7-form-control wpcf7-checkbox sameAddress" id="sameAddress">
        <span class="wpcf7-list-item first last">
            <input type="checkbox" name="sameAddress[]" value="Yes">
                <span class="wpcf7-list-item-label">Yes</span>
        </span>
    </span>
 </span>

JavaScript

$(document).ready(function() {
	
	
	$(input[value='sameAddress[]']).change(function() {
		
		var alreadyChecked = $(this).hasClass('alreadyChecked');
		
		if (alreadyChecked) {
			alert('This does not have the class');	
			$(this).addClass('alreadyChecked');
		} else {
			alert('This has the class, yay!!!!! ');
		}
		
	});
		
});