{"action":"closed","issue":{"url":"https://api.github.com/repos/wet-boew/wet-boew/issues/6702","labels_url":"https://api.github.com/repos/wet-boew/wet-boew/issues/6702/labels{/name}","comments_url":"https://api.github.com/repos/wet-boew/wet-boew/issues/6702/comments","events_url":"https://api.github.com/repos/wet-boew/wet-boew/issues/6702/events","html_url":"https://github.com/wet-boew/wet-boew/issues/6702","id":69173077,"number":6702,"title":"Click event in navigation - mega menu ","user":{"login":"GarthMartin","id":11050106,"avatar_url":"https://avatars.githubusercontent.com/u/11050106?v=3","gravatar_id":"","url":"https://api.github.com/users/GarthMartin","html_url":"https://github.com/GarthMartin","followers_url":"https://api.github.com/users/GarthMartin/followers","following_url":"https://api.github.com/users/GarthMartin/following{/other_user}","gists_url":"https://api.github.com/users/GarthMartin/gists{/gist_id}","starred_url":"https://api.github.com/users/GarthMartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GarthMartin/subscriptions","organizations_url":"https://api.github.com/users/GarthMartin/orgs","repos_url":"https://api.github.com/users/GarthMartin/repos","events_url":"https://api.github.com/users/GarthMartin/events{/privacy}","received_events_url":"https://api.github.com/users/GarthMartin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wet-boew/wet-boew/labels/Plugin:%20Menu","name":"Plugin: Menu","color":"006b75"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-17T16:36:52Z","updated_at":"2015-06-18T15:12:46Z","closed_at":"2015-06-18T15:12:46Z","body":"First some background.  I am implementing a dirty flag on my input forms to warn users if they make changes and they try to navigate away from the page.  I am overriding the click event on all navigation elements (href, buttons etc) to check the flag and prompt to confirm the navigation if there are changes.\r\n\r\nMy menu is implemented via ajax as follows:\r\n\r\n```html\r\n <nav role=\"navigation\" id=\"wb-sm\" data-ajax-fetch=\"/Sitemap/menu-en.html\" data-trgt=\"mb-pnl\" class=\"wb-menu visible-md visible-lg\" typeof=\"SiteNavigationElement\">\r\n            <div class=\"container nvbar\">\r\n                <h2>Main Menu</h2>\r\n                <div class=\"row\">\r\n                    <ul class=\"list-inline menu\">\r\n                        <li><a href=\"./index-en.html\">Manage Contacts</a></li>\r\n                        <li><a href=\"./docs/start-en.html#implement\">Manage Committees</a></li>\r\n                        <li><a href=\"./docs/start-en.html\">DAC Membership</a></li>\r\n                        <li><a href=\"./docs/start-en.html\">System Administration</a></li>\r\n                    </ul>\r\n                </div>\r\n            </div>\r\n        </nav>\r\n```\r\n\r\nand the menu file looks like this:\r\n\r\n```html\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<!-- Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW)\r\nwet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html -->\r\n<!-- DataAjaxFragmentStart -->\r\n<div class=\"pnl-strt container visible-md visible-lg nvbar\">\r\n    <h2>Main menu</h2>\r\n    <div class=\"row\">\r\n        <ul class=\"list-inline menu\" role=\"menubar\">\r\n            <li>\r\n                <a href=\"#contact\" class=\"item\">Manage Contacts</a>\r\n                <ul class=\"sm list-unstyled\" id=\"contact\" role=\"menu\">\r\n                    <li><a href=\"/contacttombstone\">Create Contact</a></li>\r\n                    <li><a href=\"/contactlist\">Search Contacts</a></li>\r\n                </ul>\r\n            </li>\r\n            <li>\r\n                <a href=\"#committee\" class=\"item\">Manage Committees</a>\r\n                <ul class=\"sm list-unstyled\" id=\"committee\" role=\"menu\">\r\n                    <li><a href=\"/Pages/CommitteeList.aspx\">Search Committees</a></li>\r\n                    <li><a href=\"/Pages/Committees.aspx\">Create Committee</a></li>\r\n                    <li><a href=\"/Pages/ManageCandidateLists.aspx\">Manage Candidate Lists</a></li>\r\n                </ul>\r\n            </li>\r\n            <li>\r\n                <a href=\"#DACManagement\" class=\"item\">DAC Membership</a>\r\n                <ul class=\"sm list-unstyled\" id=\"DACManagement\" role=\"menu\">\r\n                    <li><a href=\"/Pages/ViewCandidates.aspx\">View Candidate Membership</a></li>\r\n                    <li><a href=\"/Pages/AddContactToCommittee.aspx\">Add Membership</a></li>\r\n                </ul>\r\n            </li>\r\n             <li>\r\n                <a href=\"#SiteAdmin\" class=\"item\">System Administration</a>\r\n                <ul class=\"sm list-unstyled\" id=\"SiteAdmin\" role=\"menu\">\r\n                    <li><a href=\"/Pages/Admin/UserAdmin.aspx\">User Accounts</a></li>\r\n                    <li><a href=\"/Pages/Admin/ManageLookups.aspx\">Lookup Lists</a></li>\r\n                </ul>\r\n            </li>\r\n        </ul>\r\n    </div>\r\n</div>\r\n<!-- DataAjaxFragmentEnd -->\r\n</html>\r\n\r\n```\r\n\r\nIn my document.ready I run the following script:\r\n```javascript\r\n $(\"header a[href], footer a[href], .trigger-dirty\").each(function () {\r\n        $(this).click(function (e) {\r\n            //Prevent the default behaviour.\r\n            e.preventDefault();\r\n            \r\n            //Record the intended url. \r\n            var location = e.currentTarget.href;\r\n           \r\n            // make sure that the event actually has a HREF. Fixes the bug with the javascript(void(0)) issue when in edit mode\r\n            if (location == undefined) {\r\n                return false;\r\n            }\r\n            else {\r\n                //If the form is dirty, confirm that the user is okay with losing their unsaved data,\r\n                //before sending them to the url of their desire.\r\n                if (IsDirtyForm()) {\r\n                      Confirm(navigationWarning, function () {\r\n                        window.location.href = location;\r\n                    });\r\n                } else {\r\n                    window.location.href = location;\r\n                }\r\n            }\r\n        });\r\n    });\r\n```\r\n\r\nAll links and buttons EXCEPT those in the mega menu work as expected, even though the mega menu elements are returned by my selector above, the click event is not applied.  I have tried applying it via the wb.doc.on() syntax but doing so breaks it for all elements (possibly because of the event reference in the function callback).\r\n\r\nIs WET doing something to override the click event in the menu?\r\n\r\nThanks,\r\n\r\nGarth"}}