I've struggled with this for a while and have been following the documentaitons to a 'T' as decribed here: https://www.w3schools.com/js/js_htmldom_eventlistener.asp But I'm still getting errors. My code:
let card = document.getElementsByClassName('card');
card.addEventListener('click', cardClicked);
function cardClicked(){
console.log('clicked');
}
I get the following error:
card.addEventListener is not a function
There must be some basic programming concept I'm completely missing. Can someone help?