0

Instead of using the .addMethod() function jquery.validate offers, I'm planning to just add another method inside the jquery.validate.js itself since I'll be using my custom method for all of the forms I need. Should I proceed on editing the plugin itself? Or is there any other way I can invoke the .addMethod() without calling it redundantly on all my pages?

Hope to get your responses. :)

1 Answer 1

1

There's no reason why you can't extend jQuery validate yourself.

Does it have to be in the same file though? If it was me, I'd add the method in another .js file where my code is stored.

That way, you don't need to worry about a future developer replacing the validate file in order to prevent some new bug, and borking your code.

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

1 Comment

Do you mean creating another separate .js file with just the addMethod in it? That's actually smart! I wonder why I didn't think of that before... thanks for pointing that out. :)

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.