JSFiddle - React, Tailwind, and code Playground

by Joe Pigott

HTML

<input id='i' placeholder='Full Name'>
<br />
<input id='i2' placeholder='Email' type='email'>
<br />
<button onclick='check()'>Submit</button>
<p id='p'>Successful</p>
<p id='t'>Please fill the red box(es).</p>

CSS

#t {
    color: red;
}

JavaScript

$('p').hide();

function check() {
    i = $('#i').val();
    i2 = $('#i2').val();
    if (i !== '' && i2 !== '') {
        $('#p').show();
    } else {
        $('#t').show();
    }
}