Good evening, I'm finalizing a form check and I caught it at one point, maybe because of the way they wrote my work code I can not use jquery validate
, so I have trouble verifying that a input
field has an e -mail typed.
I made a validation code that counts the characters:
//verifica email
$("#txtEmail").blur(function() {
if ($("#txtEmail").val().length < 10) {
$("#txtEmail").css('background', '#fb4745');
$("#alertEmail").show('fast')
$("#alertEmail").text('Preencha o campo com um email valido');
}
if ($("#txtEmail").val().length >= 10) {
$("#txtEmail").css('background', '#6ebe51');
$("#alertEmail").hide('fast');
}
});
My question is: can you make a code that detects if the email field is formed by a string + @ + string? Thank you for your attention!