简体   繁体   中英

JS Function “not defined”

I'm fairly new to JS, and I have been looking around to find answers unsuccessfully. It may well be trivial but I must not be looking at the problem from the right angle.

I have a JS function using classie and scroll event working well (toggling classes). Now I wanted to add this following one but both FF and Chrome's consoles tell me the function isn't defined... and I couldn't find why. This snippet is in the < head > of a wordpress header template. The divs it should apply to are in the same header template (there are 2).

<script>
function openmenu() {
    var order = document.getElementsByClassName("menu-burger");
    var orderTotal = order.length;
    for(var i = 0; i < orderTotal ; i++){
        order[i].addEventListener("click", function ServeBurger() {
            Table13 = document.GetElementById("mobile-menu");
            classie.toggle(Table13, "show"));
            }
        , false);
    }
}
</script>

What am I doing wrong? Thanks in advance...

GetElementById应该是getElementById

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM