JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox">
<input type="text">
<button>Validate</button>

JavaScript

function validate() {
    var checked = $('[type=checkbox]').prop('checked'),
        val = $("[type=text]").val();

    if (checked && val.length) {
        alert('invalid!');
    }
}

$('button').click(validate);