0

I use jquery.validate.js plugin to client-side validate forms - validation works fine - it highlights (adds classes) correctly, it even puts labels after each empty required field - but here comes the problem - it does not put any error messages into the labels.

How to make validation plugin to add the error messages inside the label tag?

I use default - no settings :

  myForm = $("#myForm_id").validate();

SOLUTION: below as an answer :)

1
  • 1
    By default, the messages will show. And no settings is fine, but then tell us how you're defining your validation rules. You'll have to show more complete code including your HTML markup. Commented Sep 12, 2013 at 18:02

1 Answer 1

1

By default, the messages WILL show.

So especially if youre using wordpress and there is no javascript error - there is like 90% chance that your app is in conflict with some other app (plugin/theme), which could redefine the messages or completely clear them.

To fix this look for lines similar to this:

jQuery.validator.messages.required = ""; 
// or just: 
jQuery.validator.messages = "";

Remember that $ = jQuery so it can also start with $ instead.

Sign up to request clarification or add additional context in comments.

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.