Thanks Rob but i'm not sure i fully understand. Do i do this within the success function? Or is there somewhere else i can do this like say:
invalid: function(element) { $(element).parent("span").children("input, textarea").removeClass ("Valid") } That's where i'm confused - where exactly do you tell it to remove the class? On Feb 13, 11:13 pm, RobG <rg...@iinet.net.au> wrote: > On Feb 14, 8:42 am, Jon <cakeordeat...@gmail.com> wrote: > > > With the validation i have managed to make it add a class called > > 'Valid' to the label that the validation adds. However i want to make > > it add a class (same name) to the textbox too. I've managed this by > > doing: > > > success: function(element) { > > $(element).addClass("Valid").parent("span").children("input, > > textarea").addClass("Valid") > > }, > > > Which works fine. However if you add text to the textbox - so it's > > valid - then remove the text - so it's not valid - the Valid class is > > removed from the label but not from the textbox. > > > Is there an easier way to do what i'm doing? > > Add and remove the class on the parent span and make the rule > particular to the input and textarea elements (perhaps that isn't > required if they are the only descendants that will respond to the > rule anyway). > > -- > Rob