4 ms·
If you are writing a webpage that accepts email addresses, then please just use <input type="email"> and check for: document.querySelector("[type='email']"
by runarberg 5y ago
If you are writing a webpage that accepts email addresses, then please just use <input type="email"> and check for:
document.querySelector("[type='email']").validity.valid
This will not only give you email validation for free, but also gives users with software keyboards (e.g. on phones) a contextual keyboard.
- tokumei 5y agoThat’s just for the client though. Best to check on the server as an authoritative source of truth.