JSFiddle - React, Tailwind, and code Playground
HTML
<input type="button" class="check" value="Check">
<input type="text" name="user" id="user" class="user" value="">
JavaScript
$(document).ready(function(){
$(".check").click(function(){
if (!$('input.user').val()){
// DO SOMETHING
alert ('Empty');
}else{
alert("The contents are: " + $('input.user').val());
}
});
});