Add Javascript to WordPress Menu
Good that it works. If it’s for a client or if you just want a cleaner code, you can do it as @Tom J Nowell suggested. Add a custom menu item, link it to nowhere or anywhere. Find out the menu item ID (every item has one), and then target that ID with jQuery. $(“#menu-item-num”).on(“click”, … Read more