Hi guys!
I got a problem with the jQuery Validation plugin Jörn wrote.
Here is how my form looks:
Two radiobuttons that makes yes or no.
The yes radiobutton is called and has ID = #bWantStorage1
That radiobutton gives the email field a class named storage when its clicked.
And then I have the email field, and if Yes is checked ( #bWantStorage1 ) and there is a class storage and if the email field is valid so the jQuery Validation gives it valid then Id like to do an ajaxcall.
The problem Im keep having is when I first write an correct and valid email it gets the class after the hasClass event is triggerd, and if I wrote an nonvalid email, the validation engine triggers every keydown and adds the class valid or error before my script is triggerd.
Its really hard to explain, noone of my buddies could make this stuff work.
This is what I´ve written so far:
$().ready(function() {
$("#bWantStorage1").click(function() {
$("#cEmail").addClass("storage");
alert("You choose storage");
});
$("#cEmail, #bWantStorage1").live('change', function() {
if ($('#bWantStorage1').is(":checked")) {
alert("Storage choosen")
}
if ($("#cEmail").hasClass(".valid")) {
alert("Email is valid TO");
}
***// Ill do the ajaxcall here :-)***
});
});
If anyone know how to get around the problem, pleeeease write any ideas or solutions you guys have!
The problem simplified:
My hasClass function is triggerd before the cEmail gets the class from the jQuery validation plugin...
Have in mind that Im using the jQuery Validation Enginge written by Jörn, here is the site: http://bassistance.de/jquery-plugins/jquery-plugin-validation/
jQuery 1.3.2 is used for this project.