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
})
});
- 1 - suggested by - https://www.prestashop.com/forums/topic/275383-solved-disabling-parent-category-links-in-top-menu/
- 2 - suggested by - https://www.mojoportal.com/Forums/Thread.aspx?pageid=5&mid=34&ItemID=4&thread=5910&pagenumber=1
- 3 - suggested by - https://forum.jquery.com/topic/superfish-menu-how-to-disable-link-at-top-level
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
as @charlietfl advised: sf* classes are added later so I cannot use them in the selector...