JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text">
<input type="text">
<button>Button</button>

CSS

.error {
    border: 1px dashed #f00;
}

JavaScript

$('button').on('click', function() {
    console.log($('input:not([value=""])').addClass('error'));
});