Created
September 5, 2015 18:56
-
-
Save flayder/39029890796ea5467eec to your computer and use it in GitHub Desktop.
Проверка эмайл !
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var btn = document.getElementById('btn-execution'); | |
reg = /^(\w|[.])+@[a-z]+[.][a-z]{2,3}$/i, | |
reqSkype = /^\w[a-z]{1,}\d*\w*$/i; | |
email.addEventListener('keyup', function(){ | |
if (!reg.test(email.value)) { | |
email.classList.add('error'); | |
btn.setAttribute('disabled', 'disabled'); | |
} else { | |
email.classList.remove('error'); | |
btn.removeAttribute('disabled'); | |
} | |
}, false); | |
skype.addEventListener('keyup', function(){ | |
if (!reqSkype.test(skype.value)) { | |
skype.classList.add('error'); | |
btn.setAttribute('disabled', 'disabled'); | |
} else { | |
skype.classList.remove('error'); | |
btn.removeAttribute('disabled'); | |
} | |
}, false); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment