Wordpress disable parent menu using jquery

<script language=javascript>
  jQuery("#menu-firstmenu li:has(ul.sub-menu)").hover(function () {
     jQuery(this).children("a").click(function () {
        return false;


About Kapil Chugh

In love with PHP and tweaking WordPress. Hungry for Open Source and new technologies. Honest. God-fearing. Happiest when solving problems.
This entry was posted in jquery, WordPress and tagged , , . Bookmark the permalink.

7 Responses to Wordpress disable parent menu using jquery

  1. Mike Reid says:

    Hi Kapil,
    Thanks so much for this, it’s a great little plugin. I was wondering if you could help me out though. I have menus that look like this

    Community –
    North Bay

    I installed your plugin so that “Community” would not be a link, which it did perfectly. Unfortunately it also seems to have killed the link to “Ontario” as well. I assume that it is happening because while “Ontario” is a child of “Community”, it is the parent of “North Bay”. Is there an easy tweak to the script so just the top menu links are disabled, and not the sub menu links?

    Any help would be much appreciated!

    Thanks so much


  2. Carson says:

    Finally, a simple way to do this! Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s