Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Validation - Hide Error Message

I'm using the jQuery Validation plugin and want to disable the or element/container it creates to display the error 'message'.

Basically, I want the input element with the error to have the error class but NOT create an additional element containing the error message.

Is this possible?

I have just thought of a CSS workaround, but it doesn't really fix the fact that the element is still being created?

<style> label.simpleValidationError {display: none !important; } </style> 
like image 698
Sjwdavies Avatar asked Jan 06 '11 12:01

Sjwdavies


2 Answers

Use the Validator errorPlacement option with an empty function:

$("selector").validate({ errorPlacement: function(error, element) {} }); 

This effectively places the error messages nowhere.

like image 160
amichair Avatar answered Sep 19 '22 08:09

amichair


You can also use this code:

jQuery.validator.messages.required = "";  $("selector").validate(); 
like image 30
dabuda Avatar answered Sep 20 '22 08:09

dabuda