Vote count:
0
Currently learning native JS and trying to create an interactive menu.
I'm trying to run a function once the menuBtn has been clicked but I have the following error in the console.
undefined is not a function
is the global function the issue here?
(function () {
'use strict';
var menuBtn = document.getElementsByClassName('btn-nav');
menuBtn.addEventListener('click', function() {
console.log('clicked');
}, false);
}());
asked 25 secs ago
Aucun commentaire:
Enregistrer un commentaire