JQuery - call validate() on form and add a css style class to an existing element
<p>I am using JQuery-Validation-Plugin (http://docs.jquery.com/Plugins/Validation/). Now, I want to add a css-style class to an existing HTML-Element only after validate() was actually called. How to handle this? Thanks in advance. </p>

<pre><code>// take first form, validate and add css-style class to existing elements ...
var allForms = jQuery('form');
var mainForm = allForms.eq(0);
var $mainForm = jQuery(mainForm);
$mainForm.validate({
            submitHandler : function(form) {
                form.submit();
            },
            rules : {
                "user-name" : {
                    required : true
                },
                "password" : {
                    required : true,
                    minlength : 3
                }
            },
            messages : {
                "user-name" : {
                    required : "Nutzernamen-Eingabe ist erforderlich."
                },
                "password" : {
                    required : "Passwort-Eingabe erforderlich.",
                    minlength : "Mindestlänge noch nicht erreicht."
                }
            }
        });
// CSS-Klasse fuer 
jQuery('.label').addClass('repositionLabelAfterErrorMessage');
</code></pre>
