How to disable the hyperlink on top level menu of navigation using jquery

Some time we need to remove the top label hyperlink on parent menu. Here is the simple code you can use to disable the hyperlink. Make sure jquery is working on the website if not then call the jquery library. You can call your jquery from here

jQuery(function($) {
	$("id or class of your parent menu").children("a").attr('href', "javascript:void(0)");

Here is the example of HTML

<li class="parent_class"><a href="#">parent menu</a></li>
       <li><a href="#">drop down 1</a></li>
       <li><a href="#">drop down 2</a></li>
jQuery(function($) {
	$(".parent_class").children("a").attr('href', "javascript:void(0)");

Please check the and Enjoy!

Share With Friends

Also Read   How to Register a Widget Area In the WordPress with the help of function.


  1. Hi there, I found your web site by the use of Google while looking
    for a similar matter, your web site came up, it seems good.
    I’ve bookmarked it in my google bookmarks.
    Hello there, simply changed into aware of your blog via Google, and
    found that it’s really informative. I am going to be careful for brussels.
    I will be grateful in case you proceed this in future.

    Numerous other folks will likely be benefited from your
    writing. Cheers!

Speak Your Mind


Time limit is exhausted. Please reload CAPTCHA.