JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head></head>
<body>
<form name="myForm" onsubmit="return validateForm()" method="post">
<input id = "name" type = "text" value="test">
<button type="submit">submit</button>
</form>
</body>
</html>
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
JavaScript
$(function(){
})
function validateForm(){
var len = $('#name').val().length;
if(len <= 0){
return false;
}
else{
return true;
}
}