The hideIfOutside function was being too restrictive with the selector for checking if the event occurred within a menu child (anchor tag) rather than the menu itself.