Last active
August 29, 2015 14:01
-
-
Save proteste-dcm/699a728138874113600c 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
<!DOCTYPE html> | |
<!-- TE AMOOOOOOOOOOO --> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
function validaEmail(obj) { | |
var valor = obj; | |
console.log(valor.value) | |
if (valor.value === "") { | |
valor.focus(); | |
} else { | |
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; | |
if (regex.test(valor.value) === true) { | |
$('.senha').focus(); | |
} else { | |
alert("Email errado"); | |
valor.focus(); | |
} | |
} | |
}; | |
$('.email').blur(function(){ | |
validaEmail(this); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<input type="text" name="email" class="email"> Email 1<br> | |
<input type="text" name="email" class="email"> Email 2<br> | |
<input type="text" name="email" class="email"> Email 3<br> | |
<input type="password" name="senha" class="senha"> Senha | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment