arrow_back How to start menu? Uncaught TypeError: Cannot read property 'open' of undefined?

0 votes
<nav id="my-panel">
<li><a href="/">Home</a></li>
<li><a href="/about/">About us</a>
<li><a href="/about/history/">History</a></li>
<li><a href="/about/team/">The team</a></li>
<li><a href="/about/address/">Our address</a></li>
<li><a href="/contact/">Contact</a></li>
<button id="toggler" class="hamburger" type="button">
<span class="hamburger-box">
<span class="hamburger-inner"></span>

$(document).ready(function() {
var API = $("#my-menu").data("mmenu");

$("#toggler").click(function() {;

выбивает ошибку
Uncaught TypeError: Cannot read property 'open' of undefined
at HTMLButtonElement. (scripts.min.js:1)
at HTMLButtonElement.dispatch (jquery.min.js:3)
at HTMLButtonElement.q.handle (jquery.min.js:3)

Памагите что делать ?

1 comment

When you refer to a variable API, you pass it ordinary text. Course text there is no such properties/methods as open, and swears.

You should carefully read, such as on Habre article contains an example:

In your case you can specify this: var API = $("#my-menu").mmenu().data("mmenu");

1 Answer

0 votes
And anything that you have or where no id my-menu ?