JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<input type='text' value='' />
<input type='submit' />
</form>
JavaScript
$('form').submit(function() {
var error;
if ( !$('input').val() ) {
error = true
}
if (error) {
alert('there are errors')
return false
}
});