Clear fields marked by has-error

0

I have a form where when wanting to register, send an alert marking the outline of the fields in red in addition to displaying a message, all this created by the class has-error .

This is the code I use to do the above said.

$("#itemDes").parent().addClass('has-error');
	$("#price").parent().addClass('has-error');
	$("#manufacturer").parent().addClass('has-error');
	$("#model").parent().addClass('has-error');
	$("#min").parent().addClass('has-error');
	$("#max").parent().addClass('has-error');
	$("#engineer").parent().addClass('has-error');
	$("#category").parent().addClass('has-error');
	$("#location").parent().addClass('has-error');
	$("#supplier").parent().addClass('has-error');
	$("#unit").parent().addClass('has-error');
	$("#item").parent().addClass('has-error');
	document.getElementById("errorMessage").style.display = "block";
	document.getElementById("errorMessage").innerHTML = "No puedes dejar campos en blanco, completa la informacion.";
	document.location.href="#errorMessage";

My problem is that when they are marked in red and others, I cancel, I open the form again, they continue in red, I need that this does not happen anymore, and that it appears as the first time it was opened.

    
asked by Pato 27.11.2018 в 23:13
source

0 answers