How to hide error message in JavaScript

I have two text boxes placed in two divs if user clicks on button i will show error message to user that they are mandatory but againg if user types the text in the textbox i need to hide the error message using jquery how can i do this

Txt1 is mandatory

Txt2 is mandatory


By default, all error messages are placed inside a container that has .fv-plugins-message-container class. We can hide the error messages by adding one CSS property for this class:

.fv-plugins-message-container {

Handling the event

After executing a given validator, the Message plugin will emit the plugins.message.displayed event. This event is triggered after the error message is displayed. We can listen on this event to hide the error message:

Answer: Yes – although usually it is not a good design decision to do so. (Normally, you are much better off fixing the errors, rather than just suppressing the error messages.)

To suppress all JavaScript error messages on your HTML page, you can put the following script code in the section of your page:

Or you can use a similar code fragment (without the SCRIPT tags) in an included .js file, if you have one. For a working code example, see this error handling demo!

I used the solution above, and it works to remove the red color and message. But when the fields are set as required again, the red color and message don't return. Do I then have to add the parsley-error class onto the field again? Doing that makes it turn red right away. Is there a way to use the parsley().reset() method, which is suppose to set the field back to the original state?

0 0

Post Link

replied on March 14, 2017

Yeah you could use $('#Field1').parsley().reset() for a certain field or $("#form1").parsley().reset() for the whole form.

Note that after reset the fields are not validated immediately (it will validate on blur or submit.) If you need the red color and message to show up immediately you could use $('#Field1').parsley().validate()

0 0

Post Link

replied on November 22, 2017

Hi all,


I tried to apply your solution but unsuccess.


I just want to hide error message.


This is what i did :

$('.Field25 .parsley-error').hide();


Someone can help me?

Thanks in advance.



0 0

Post Link

View 1 previous reply

replied on November 22, 2017

Hi Olivier,

Is it a formula error? If so, the way for hiding error message would be different.

You may try:

$('#q25 .formula-error-list').hide();


0 0

Post Link

replied on November 27, 2017 Show version history

Hi Rui Deng,


I suppose this is a formula error but i'm not sure. What is the others ways?

Anyway ; i tried without success :

$('#q25 .formula-error-list').hide();
$('.q25 .formula-error-list').hide();
$('#Field25 .formula-error-list').hide();
$('.Field25 .formula-error-list').hide();

I still have the same error.


I used Calcul to get value.


Idk if this could help.


0 0

Post Link

replied on November 27, 2017

Hi Olivier,

Since it's formula error, you need to trigger hiding formula error when the formula reference fields change (they are Return_Date and Beginning_Date as your formula shows).

So the whole script would be like:

  $('li[attr=Return_Date] input').change(clearFormulaError);
  $('li[attr=Beginning_Date] input').change(clearFormulaError);
  function clearFormulaError()
    $('#q25 .formula-error-list').hide();
    $('#q25 input').removeClass('formula-error');


0 0

Post Link

replied on June 4, 2018

Hi Rui, 


Thanks for the information provided, I am looking for something similar where I have a calculation happening based on (Required*Price)-(Discount%) which works perfectly but I am seeing the following before any data is entered: 


Is there any way I can hide that as the fields have not been populated yet? 

Basically, the form is started by the user selecting the Customer which has a % discount, once that is shown, the error is displayed. It is then cleared once you enter the Required and the price as the calculation is then valid, 

How to hide errors in JavaScript?

Simple and easy, put this code at the beginning of your code: console. log = function(){}; All the console messages will magically disappear...

How to display message in JavaScript without alert?

We can show errors with two methods without using the alert box. Syntax: node. textContent = "Some error message" // To draw attention node.

How to remove warning in JavaScript?

The only way to remove it is to call the alert from a trusted function in a folder level script. In this case you can put any message you want in the cTitle property of the alert. Another option is to add a certification signature, and convince your users to trust your certificate and allow privileged JavaScript.

How to hide the error message in jquery?

Use the Validator errorPlacement option with an empty function: $("selector"). validate({ errorPlacement: function(error, element) {} }); This effectively places the error messages nowhere.