hebrerillo
Active Coder
Hello there!
I have a form that I am validating using the Form Validtion API in JS. I would expect the email address 'hannibal@gmail' to be invalid.
However, the API returnts that it is valid. Here is an example:
The console yields a false, meaning that it is not invalid. But I would expect a type mistmatch error.
Am I missing something??
I have seen other implementations where they use a regex, but I would prefer the JavaScript validation API.
Thank you so much!
I have a form that I am validating using the Form Validtion API in JS. I would expect the email address 'hannibal@gmail' to be invalid.
However, the API returnts that it is valid. Here is an example:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<form >
<input type="email" name="email" value="hannibal@gmail" />
</form>
<script>
const email = document.querySelector("input");
console.log(email.validity.typeMismatch);
</script>
</body>
</html>
The console yields a false, meaning that it is not invalid. But I would expect a type mistmatch error.
Am I missing something??
I have seen other implementations where they use a regex, but I would prefer the JavaScript validation API.
Thank you so much!