JSFiddle - React, Tailwind, and code Playground
by Santosh J
HTML
<input style="margin-top: 20px;" type="text" placeholder="Enter an Email ID" name="Email" id="Email" pattern="((\w+\.)*\w+)@(\w+\.)+(com|kr|net|us|info|biz)" required="required">
<input type='button' id='temp' value='save'>
JavaScript
function checkStatus() {
var productcode = $("#Code").val();
var productEmail = $("#Email").val();
//alert("email is== "+Email)
if (document.getElementById("Email").value == '') {
alert("Please Enter Email ID");
return false;
} else if (!document.getElementById("Email").checkValidity()) {
alert("Please Enter Valid Email Id");
return false;
} else
{
callMeIfValid();
}
document.getElementById('Email').value = '';
}
function callMeIfValid() {
alert("valid input");
}
$('#temp').click(function () {
checkStatus()
})