jquery - Adding classes to my Nav bar -


looking bit of jquery, looking add class first ul under nav tag , looking add different class every li parent ul.

the code nav bar below, current jquery code doesn't seem want work.

i have add them jquery due platform developing for.

thanks in advance george

<nav class="uk-navbar" id="navbarnav"> <ul add class here>     <li class="uk-active"><a href="index.html" rel="self" id="current">home</a></li>     <li add class here><a href="page1/index.html" rel="self">page2</a>         <ul>             <li><a href="page1/page4/index.html" rel="self">sub1</a></li>             <li><a href="page1/page5/index.html" rel="self">sub2</a></li>         </ul>     </li>     <li><a href="page2/index.html" rel="self">page3</a></li>     <li><a href="page3/index.html" rel="self">page4</a></li> </ul> 

$('#navbarnav ul').addclass('uk-navbar-nav'); $('#navbarnav ul li').has(ul).addclass('uk-pearent'); 

try this

   $('#navbarnav ul').addclass('uk-navbar-nav');    $('#navbarnav ul li ul').removeclass('uk-navbar-nav').addclass('uk-pearent'); 

demo


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -