Read errorPlacement on validate docs.

    $(document).ready(function() {
        $("form").validate({
            errorPlacement: function(error, element) {
                $(element).prev().addClass("error");
            }
        });
    });

<label>Input:</label><input type="text" id="txtInput" name="txtInput"
class="required" />

On Jul 23, 3:03 pm, Rizky <br4inwas...@gmail.com> wrote:
> Hi,
>
> I need help with the Validation plugin. I want to disable the
> generated error labels and I need to find a way to add the class
> "error" to existing form labels instead. Currently I don't use it and
> simply want to add highlighting to the existing fields and labels.
>
> My forms already contain fields with corresponding labels (using the
> basic "for" - "id" relationship). And all i need to do now is to add
> the class "error" to these labels if the corresponding fields has
> errors.
>
> Sorry if this question have been asked before.
>
> Thx

Reply via email to