Add click support to 'Header Submenus' component

I am using the Header submenus theme component to style our header to match our other developer properties. There is a top-level ‘Community’ item in the header, but with the plugin, top-level entries don’t have an href associated. I wrote some simple javascript to catch the click event and send them to the home page. It works fine in my simple test html and if I open the javascript console in my site and type the javascript in, it works on my site. I just can’t figure out where to put it in my theme to add the functionality.

I have tried adding it to all of the available options, but the javascript never runs. If I put it in Head, I get an error because it loads referencing a DOM object that doesn’t yet exist, so I know it sees it, but it never works.

I appreciate any guidance y’all can provide.

Thanks!

I figured it out.

Here’s the code if anyone else needs to do something similar.