JSFiddle - React, Tailwind, and code Playground

HTML

<form id='form' onsubmit="return validate()" type="GET">
    <input type="text" id="nameFirst" />
    <input type="text" id="nameLast" />
    <input type="submit" />
</form>

CSS

form.invalid {
    border: 1px solid #f60;
}

JavaScript

function validate() {
    var nameFirst = document.getElementById('nameFirst');
    var nameLast = document.getElementById('nameLast');
    if (nameFirst.value.indexOf('&') != -1 || nameLast.value.indexOf('&') != -1) {
        document.getElementById('form').className = 'invalid';
        return false;
    }
    return true;
}