OiO.lk Blog javascript element.classList.remove(“u-hidden”) does not work
javascript

element.classList.remove(“u-hidden”) does not work


I am using the following code:

 var el = document.getElementById("MY_ITEM");
 el.textContent = "TEST";
 el.classList.add("success_message");
 el.classList.remove("u-hidden");

Everything works up until the line 4. No error message, just that class u-hidden does not get removed from the element so I cannot see it in the browser. Is there a better way to do that?



You need to sign in to view this answers

Exit mobile version