1

I am battling to get jquery.validation to work with a custom method.

I am trying this

 $.validator.addMethod("validateMe", function (value, element) {
        alert("validate");
    });
$( "#myTextBox" ).rules( "add", {
    validateMe: true
  });

I am using jquery.validate v1.12 but when trying to validate I get an error of

Uncaught TypeError: Cannot read property 'call' of undefined 

Am I missing something here?

1
  • You found a solution? Commented Dec 15, 2014 at 21:32

1 Answer 1

2

If anyone else has the same problem it turns out I wasnt providing a message

 $.validator.addMethod("validateMe", function (value, element) {
    alert("validate");
 }, 'Hello message!');

did the trick

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.