Search code examples
javascriptjquerymmenu

jQuery menu not working on server but working properly on localhost


In https://harissonsbags.com jquery menu not working but the same code is working properly on localhost.

This is the code snippent.

jQuery(document).ready(function( $ ) {
    $("#mobile-menu").mmenu({
        classes: 'mm-light'
    }, {
        selectedClass: "active",
    });
});

I ran this code on javascript console on the website.

jQuery("#mobile-menu").mmenu({
        classes: 'mm-light'
    }, {
        selectedClass: "active",
    });

Then the menu accordion is working. While page loading the javascript is not executing.

Any suggestion would help.


Solution

  • Your page has some JavaScript errors pertaining to this code below:

    var el = document.getElementById("zipcode");
    
    el.onkeyup = function(evt) {
        var fieldValue = el.value;
        if(fieldValue.length == 6) {
            codeAddress(fieldValue);
        }
    };
    

    Fixing this should fix your menu as this code is not in an document ready tag it is running first and causing all other JavaScript to not execute.