JSFiddle - React, Tailwind, and code Playground

HTML

<form>
    <input type='text' name='item'/>
    <input type='submit'/>
</form>

JavaScript

$('form').on('submit', function(e){
    if( $('input[type=text]').val() == '' )
    {
        
        e.preventDefault();
    }
    else
    {
        alert('Form submitted');
    }
});