Ok, I've tried a few things, but I'm stuck here...
Here's the HTML I'm working with:
<div class="required">
<label for="paysys_idworldpay" class="labelRadio">
<input type="radio" value="worldpay" name="paysys_id" id="paysys_idworldpay" class="inputRadio"/>
<b>WorldPay</b></label>
<label for="paysys_idoffline" class="labelRadio">
<input type="radio" value="offline" name="paysys_id" id="paysys_idoffline" class="inputRadio"/>
<b>Paypal</b></label></div>
<div class="required">
<label for="email">Email Address</label>
<input type="text" value="" name="email" class="required email inputText" id="email" /></div>
and this is the code I've got in validate() function for this form:
errorElement: 'p',
errorClass: 'error',
errorPlacement: function(error, element) {
error.insertBefore(element.prev());
element.parent().addClass('error');
},
success: function(label){
label.removeClass('error');
label.parent().removeClass('error');
}
Now, that works just fine for a field like "email" in the above form (it inserts a paragraph and assigns it a class="error" along with adding "error" to the class in wrapping div)... but for the radio buttons it doesn't work the same way - it adds the "error" class to the surrounding label, and it doesn't even insert a paragraph with an error class. Why?
What am I missing/doing wrong here?
Also, how do I actually REMOVE the added paragraph in "success" portion? As it is right now, it just gets removed the "error" from its class attribute, and with every letter typed into the input field it adds another empty paragraph like this:
<p generated="true" class=""/>
So I end up with a bunch of those in every div for each field (depending on how many characters are typed in)... again, what am I missing?