I have been searching for the solution for a while... I thought I had found it but in the end it doesn't work and I just can't manage anymore to see what I have done wrong...
What I want to achieve is that when in my contactform the inputfield for "#email" contains a wrong e-mailadress the border should highlight red. Right now with my code it only does this highlighting when the inputfield has been left empty. So I want to check if the value of the inputfield #email contains an @-character or not.
Here is my jQuery code for the input field #email:
$("form").on("submit",function(){
valid = true;
if ($("#email").val() == '' || $("#email").val().indexOf(/[@]/) == false ) {
$("#email").css("outline-color","#FF4E00")
$("#email").css("outline-style", "solid");
$("#email").css("outline-width", "2px");
$("#email").attr("placeholder" , "Vul een correct e-mailadresin!");
$("#email").css("color", "#FF4E00");
valid = false;
}
)};
Can anybody help me? I am new at this and it is a bit unclear right now... And sorry for my confusing english...