How to show text in id="result" When not a invalid email ?
When i fill not a valid email EG: xxxxxxx in input name="email"
i want to show text in id="result" EG: xxxxxxx not a valid
<!DOCTYPE html>
<html>
<head>
<script>
function validateForm() {
    var x = document.forms["myForm"]["email"].value;
    var atpos = x.indexOf("@");
    var dotpos = x.lastIndexOf(".");
    if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) {
        $("#result").text("");
        $("#result").text(x + " not a valid :)");
        return false;
    }
    else {
        alert("OK");
    }
}
</script>
</head>
<body>
<form name="myForm" action="demo_form.asp" onsubmit="return validateForm();" method="post">
Email: <input type="text" name="email">
<input type="submit" value="Submit">
</form>
<h2 id='result'></h2>
</body>
</html>
 
    