0
I have two conditions in a pure javascript code; if the request sent via restful was received by the service I show on the screen a sentence in green color, if not, another sentence in red color. I’m trying to use classList.add for this, but I’m not getting results:
let erro = "";
erro = "Categoria já existente no sistema";
document.querySelector(".categoria-aviso").innerHTML = erro;
erro.classList.add('erro');
This way he is not displaying the text in red color. I thank those who help.