JSFiddle - React, Tailwind, and code Playground
HTML
<form id="myform">
<input type="text" name="myinput" required />
<input type="email" name="myemail" required />
</form>
<div id="externalcheck">click to validate</div>
JavaScript
$("#externalcheck").click(function () {
$('#myform input').each(function () {
if (!this.checkValidity()) {
alert($(this).prop('name') + ' is not valid');
}
});
});