0

I am using jquery validate plugin (http://bassistance.de/jquery-plugins/jquery-plugin-validation/).

the default message to warn user to complete required field is "This field is required." but i want to change it.

how can i change it? I don't want to define a message for each field,I want a new message for all fields.

I use this code,but message doesn't change:

$("#RegisterForm").validate({
          messages: {
               required: "This field is ."
          }
});

2 Answers 2

2

After you run your validate method. Do this $.validator.messages['required'] = 'my message'; Or

alternatively you can pass this as an option in your validate method

.validate({
   //options
   messages: {
     required: "my message"
   }
});
Sign up to request clarification or add additional context in comments.

1 Comment

No, it doesn't work.but i found these codes and it did what i want: jQuery.extend(jQuery.validator.messages, { required: "My message" });
2

I found these codes and it did what I want:

jQuery.extend(jQuery.validator.messages, 
     { required: "My message" });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.