I use superfish Menu Plugin - v1.7.4 and I want to disable the links of the top level.
I tried the following:
$(document).ready(function() {
// does not work 1:
$('div#block_top_menu > ul.sf-menu > li > a.sf-with-ul').bind('click', false); // only direct children
// does not work 2:
$('div#block_top_menu > ul.sf-menu > li > a.sf-with-ul').attr("href", "#"); // disable top-level links by replacing with #s
// does not work 3:
$('div#block_top_menu > ul.sf-menu > li > a.sf-with-ul').click(function(){
return false; // disable browser default when link is clicked
})
});
but none of them helped.
Probably all related to elder versions of superfish or to other plugins.
so, How can I disable the top level links?
I use
$('div#block_top_menu > ul > li > a').attr("href", "#");
as @charlietfl advised: sf* classes are added later so I cannot use them in the selector...