I’m developing a new site that has a navigation that is built dynamically via wordpress’ wp_list_pages function
<?php wp_list_pages('sort_column=menu_order&title_li=&exclude=6'); ?>
Navigation items that have submenus (css dropdowns) are still clickable, but for this website they have no content. I wanted a way to make those items unclickable. I was unable to find any way with wordpress’ api, but I did find a way with jquery.
$('#navigation_ul > li > a').filter( function() { return $(this).siblings().length > 0 } ).attr( 'href', '#' ) .attr( 'onClick', 'return false' );
This sets the href to ‘#’, and onClick to ‘return false’ of all navigation links that have submenus