Hello Clever’s
I’m getting an “.addEventListener is not a function” error. I am stuck on this:
HTML
<div class="container">
<nav class="nav">
<div class="menu-toggle">
<i class="fas fa-bars"></i>
<i class="fas fa-times"></i>
</div>
<a href="index.html"><img src="/images/logo.png" alt=""></a>
<ul class="nav-list">
<li class="nav-item">
<a href="#" class="nav-link">Home</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Menu</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Reservations</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">News</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Shop</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Contact</a>
</li>
</ul>
</nav>
and this JS Code
const selectElement = function (element) {
return document.querySelector(element);
};
let menuToggler = selectElement('.menu-toggle');
let body = selectElement('body');
menuToggler.addEventListenner ("click", function() {
body.classList.toggle('open');
});
but In Console Say
"
Uncaught TypeError: menuToggler.addEventListenner is not a function
at main.js:14
"
can anyone give me solution please
THX