MCPcopy
hub / github.com/bradtraversy/vanillawebprojects / checkEmail

Function checkEmail

form-validator/script.js:22–29  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

20
21// Check email is valid
22function checkEmail(input) {
23 const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
24 if (re.test(input.value.trim())) {
25 showSuccess(input);
26 } else {
27 showError(input, 'Email is not valid');
28 }
29}
30
31// Check required fields
32function checkRequired(inputArr) {

Callers 1

script.jsFile · 0.85

Calls 2

showSuccessFunction · 0.85
showErrorFunction · 0.85

Tested by

no test coverage detected