jquery.validator.addmethod custom error message

How to implement a custom dynamic error message to your jQuery Validator method?

In the above code the message for the validator method is set by using

where the response.msg is the message we receive from the server.

This is a good and simple JavaScript snippet for the jQuery Validator plugin on how to add a jquery.validator.addmethod custom error message.

If you find this useful leave us a comment.

How to prevent form submit on enter using jQuery

I had a client that pressed enter after typing in a form by mistake and kept saying that my script had an error.
After disabling the form submission on enter key the problem vanished 🙂

Prevent form submit on enter script :