Important Notice:

Email Validation

Email Validation

23 views 1 min read

3. Email Validation

Email Validation का उपयोग यह जांचने के लिए किया जाता है कि User द्वारा दर्ज किया गया Email Address सही प्रारूप में है या नहीं।

आपके उदाहरण में केवल यह चेक किया गया है कि Email में @ चिन्ह मौजूद है या नहीं।

Example

<!DOCTYPE html>
<html>
<body>

<form onsubmit="return validateEmail()">
Email:
<input type="text" id="email">
<br><br>
<input type="submit">
</form>

<script>
function validateEmail() {
    let email = document.getElementById("email").value;

    if (!email.includes("@")) {
        alert("Invalid Email");
        return false;
    }
    return true;
}
</script>

</body>
</html>

Related Notes