Dropdown menu close on click

So the dropdown menu doesn’t close automatically on close nor does it populate the dropdown text with your selection. I’ve found a forum post saying that the dropdown element can be closed programatically with some custom code but the poster wasn’t very clear on which elements in the dropdown needed to be assigned the appropriate class names and ID’s for this to work.

The code is as follows:

mylinkclass = ".mynavlink";
mywdropdownelement = "#mydropdown";

if($(mylinkclass).closest('.w-dropdown-link')) {
        var gg = $(mywdropdownelement);
        $.each(gg[0], function(key, element) {
            if (key.substring(0, 6) == "jQuery") {
              gg[0][key][".w-dropdown"].leave();
              return false;
            }
        });
}

Can someone explain where the in the dropdown I need to apply the class name of “mylinkclass” and the ID of #mydropdown?


Here is my public share link: LINK
(how to access public share link)