I am having trouble removing the ‘hidden’ class on my inputPlaceholder. I checked the console, and the hidden class remains after clicking the “allClearBtn.”
Here is my code:
const resultBox = document.querySelector("#result");
const inputPlaceholder = document.querySelector('.result-span')
function clearInput() {
inputPlaceholder.classList.remove('hidden',);
}
numberBtns.forEach(function (number){
number.addEventListener("click", function(){
inputPlaceholder.classList.add('hidden');
resultBox.innerHTML += number.innerHTML;
});
});
I tried using classList.replace(), using a visible class which set my inputPlaceholder to “display:block”, but that did not work. I also made sure my clearInput function was being triggered by doing resultBox.textContent = ”, which did work.