JSFiddle - React, Tailwind, and code Playground

by Aldi Unanto

HTML

<form name="myForm" action="main.php" onsubmit="return validateForm()" method="post">
    <input type="text" id="u" />
    <input type="submit" value="submit" />
</form>

JavaScript

function validateForm() {

  if ($('#u').val() == '') 
  {
     alert("no value found");
     return false;
  }

}