• Resolved awstyle

    (@awstyle)


    I have tried creating custom menu items which have no pages attached but have child menus items. I have inserted javascript: void(0); as the URL but when I save the menu the url becomes blank.

    I am very new to WP.

    Kind regards

    Tony

Viewing 3 replies - 1 through 3 (of 3 total)
  • Remon

    (@remonlumapas)

    Try doing this with jQuery. Leave your menu with “#” in the url, and use the class to change the url using jQuery like this:

    $(".your-menu-class a").attr('href', 'javascript:void(0)');

    Or you could insert a hash tag # instead of void(0);

    If you can’t live with jumping to the top of the page when clicking the link you could also block the link “execution” via JS (here jQuery):
    jQuery('.your-menu-class a').click(function(){return false;});

    Thread Starter awstyle

    (@awstyle)

    Thanks guys.
    Kind regards
    Tony

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Menus and Javascript’ is closed to new replies.