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
should be getElementById