javascript – Clean fields marked by has-error

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');
$ ("# provider"). parent (). addClass ('has-error');
$ ("# unit"). parent (). addClass ('has-error');
$ ("# item"). parent (). addClass ('has-error');
document.getElementById ("errorMessage"). style.display = "block";
document.getElementById ("errorMessage"). innerHTML = "You can not leave fields blank, fill in the information.";
document.location.href = "# errorMessage";

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