Flames Posted March 7, 2009 Share Posted March 7, 2009 Earlier today I decided to use JQuery to help with Ajax, and I started using certain styles so I decided I'd change all my validation to work with JQuery. This is part of my JS to validate of 2 username fields are the same $("#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 this is the code of the 2 fields (ignore the \'s its because it is 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> Problem is the code always says that the 2 values are the same. Any help please? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted March 7, 2009 Share Posted March 7, 2009 have you added the firebug plugin on firefox to make sure there are no errors? maybe install the validation plugin for Jquery? just a thought Quote Link to comment Share on other sites More sharing options...
Flames Posted March 7, 2009 Author Share Posted March 7, 2009 Well I have firebug how can I use it to check for errors? FF error console returned no errors and im currently looking up the validation plugin Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted March 7, 2009 Share Posted March 7, 2009 firebug should list them automatically on the bottom load bar when its done loading will be a red x with (#)errors if there are any im sorry you need the debug plugin not validation sorry Quote Link to comment Share on other sites More sharing options...
Flames Posted March 8, 2009 Author Share Posted March 8, 2009 Tried the debug plugin didnt give any bugs, nor did firebug. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted March 8, 2009 Share Posted March 8, 2009 got a link to a working script ??? Quote Link to comment Share on other sites More sharing options...
Flames Posted March 8, 2009 Author Share Posted March 8, 2009 Thanks but i dont need your help anymore, people on the JQuery support group knew the answer it shouldnt be .value it should be .val() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.