[jQuery] Help with JQuery checking 2 fields are same
I have a Username field and a repeat Username field. The repeat one
calls this function
$("#user2").blur(function()
{
$("#msgbox_check").removeClass().addClass('messagebox').text
('Checking...').fadeIn("slow");
if($(this).value == $("#user").value)
{
$("#msgbox_check").fadeTo(200,0.1,function() //start fading the
messagebox
{
//add message and change the class of the box and start fading
$(this).html('Inputted Username\'s match').addClass
('messageboxok').fadeTo(900,1);
});
}
else
{
$("#msgbox_check").fadeTo(200,0.1,function() //start fading the
messagebox
{
//add message and change the class of the box and start fading
$(this).html('Inputted Username\'s do not match').addClass
('messageboxerror').fadeTo(900,1);
});
}
});
and the form (\'s due to being php not HTML)
<tr><td>Username</td><td><input type=\"text\" name=\"user\" id=\"user
\" > <span id=\"msgbox\" style=\"display:none\"></span></td></tr>
<tr><td>Repeat Username</td><td><input type=\"text\" name=\"user2\" id=
\"user2\"> <span id=\"msgbox_check\" style=\"display:none\"></span></
td></tr>
It always returns that they are matching even when they are not.
Please help
Example http://www.FlameWars.co.cc/register.php