Hi, could anybody help me figure out why javascript code will not work.
I have put the javascript code in custom-script.js in a child theme, called twentythirteen-child.
And have enqueued it in functions.php and put the html on the wordpess page.
Here is the javascript code:
let counterDisplayElem = document.querySelector('.counter-display');
let counterMinusElem = document.querySelector('.counter-minus');
let counterPlusElem = document.querySelector('.counter-plus');
let count = 0;
updateDisplay();
counterPlusElem.addEventListener("click",()=>{
count++;
updateDisplay();
}) ;
counterMinusElem.addEventListener("click",()=>{
count--;
updateDisplay();
});
function updateDisplay(){
counterDisplayElem.innerHTML = count;
};
here is the enqueued code in functions.php:
and here is the html in worpress page: