Skip to content

Instantly share code, notes, and snippets.

@flayder
Created September 5, 2015 18:56
Show Gist options
  • Save flayder/39029890796ea5467eec to your computer and use it in GitHub Desktop.
Save flayder/39029890796ea5467eec to your computer and use it in GitHub Desktop.
Проверка эмайл !
(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