JSFiddle - React, Tailwind, and code Playground
HTML
<form id="bcscan" action="" method="post">
<input type="text" />
<input type="text" />
<input type="text" />
<button type="submit">Submit</button>
</form>
CSS
.warning {
background: red;
}
JavaScript
$(document).ready(function () {
$("#bcscan").submit(function (e) {
e.preventDefault();
var invalidCount = $('input').filter(function() {
return ($(this).val() === ' ');
}).addClass('warning').length;
if (invalidCount == 0) {
alert('valid');
}
});
});