After much searching and fiddling I finally found a solution to this problem…
Basically I have a site where some top level items in the main menu are purely for categorization; they don’t have actual pages to link to. So how do we prevent them from linking? Well initially I’d stick a # in to the href= but that causes the page to jump to the top when clicked so we need to disable all links with the hash for the href. Here’s the code:



/**
 * Prevent all links with # as the href from doing anything
 */
jQuery(document).ready(function($) {
    $('a[href="#"]').click(function(e) {
        e.preventDefault();
    });
});