JSFiddle - React, Tailwind, and code Playground

HTML

<input name="a" type="checkbox" value="here"/>(if this was checked)
 <input name="b" type="checkbox" value="here"/>(then this)
 <input name="c" type="checkbox" value="there"/>(would not allow prompt alert) 
 <input name="d" type="checkbox" value="here"/>(would allow)

JavaScript

$(function() {
    $('input[type=checkbox]').click(function() {
        if ($(this).is(':checked')) {
            if ($(this).prev().prop('checked')) {
                if ($(this).val() != $(this).prev('input[type=checkbox]').val()) {
                    alert("previous checkbox has same value");
                }
            }
        }
    });
});