views:

34

answers:

1
$(document).ready(function () {
              $("#frm").validate({
            errorClass:"invalid",
               rules: {
                    cname: { required: true,minlength:5 },
                    cemail: { required: true, email: true }
                }
            });
        });

I am using above function to validate my html form. Validation is working fine. But I want to remove the default error message. I dont want to give any error message, just need to change the background color of the control for which validation fails.

+4  A: 

You can just give them an empty error message string, like this:

$("#frm").validate({
    errorClass:"invalid",
    rules: {
        cname: { required: true },
        cemail: { required: true, email: true }
    },
    messages: {
        cname: "",
        cemail: ""
    }
});

You can test it out here.​

Nick Craver