views:

959

answers:

4

Until now, I've used jQuery validation plugin with previously defined fields. Now I'm working with a dynamic form. Fields have their validation needs mapped by its classes (e.g. " required "), but I don't see how to customize the messages jQuery validate throws.

+4  A: 
$.validator.messages.required = "My new, default required message!";
Craig Stuntz
+7  A: 

you can add your messages like so.

    $.extend($.validator.messages, {
        required: "your msg",
        email: "your email msg",
        digits: "your digits msg"
    });

See setDefaults

Bjarki Heiðar
+2  A: 

setDefaults

Daniel Moura
A: 

I am also using $.extend($.validator.messages, {, but my errormessages are dynamic which are stored in attrbiute of my control ,now i want to retrieve the attribute here,something like $(element).attr('ErrorMessage')

but it is not working

Punit

related questions