Forums
Home / Plugins / Hacks / how to add javascript:void(0); in main nav items
(@burakakin)
9 years, 9 months ago
Hello , I am a newbie in wp. I created my main menu but I cant use dropdowns correctly I am trying to convert :
<nav> <ul id="navigation"> <li class="current_page_item"><a href="index.html"><span>Home</span></a></li> <li class="drop"><a href="javascript:void(0);"><span>Features</span></a> </ul>
I cant add js to href items until now I came up with the solution : <?php wp_nav_menu( array('menu' => 'Main','menu_id'=>'navigation','link_before' => '<span>','link_after' => '</span>')); ?>
<?php wp_nav_menu( array('menu' => 'Main','menu_id'=>'navigation','link_before' => '<span>','link_after' => '</span>')); ?>
and in functions :
add_theme_support('nav-menus'); if(function_exists('register_nav_menus')){ register_nav_menus( array( 'main'=> 'Main Nav' )
can you help me to add js ?