I have this html form code:
$("#email").blur(function(){
//check to two here.
if ($("#email").val() != $("#email_repeat").val())
{
$("#email_repeat").keyup(function(){
if ($("#email").val() != $("#email_repeat").val()) {
// emails don't match
}
});
}
});
<label for="email">Email address:</label>
<input type="email" id="email" name="email" placeholder="[email protected]"
title="Enter email address" required>
<label for="email_repeat">Confirm email address:</label>
<input type="email" id="email_repeat" name="email_repeat" placeholder="[email protected]"
title="Confirm email address" required >
I want to make sure they match in real time and I know i need to use the on key up event.
What am I missing here?
You are defining a keyup event every time on check. It is absolutely wrong and illogically.
It is like you say:
This is how it should be done:
That's how I say: