Support » Fixing WordPress » addClass not working

  • Resolved The_Doomed

    (@the_doomed)


    Well, I’ve got a little Problem.
    I want to add a class to my dropdownmenu (wp_list_pages) which is applied only to li elements with a submenu (ul with class children).
    I tried to use the jQuery code below but it doesn’t apply the class. With a .css(…) it works fine but thats no very dynamic.

    jQuery('ul.children').parents().addClass('has_children');
    <nav class="page-nav">
    <ul>
    <li class="page_item">point 1
    <ul class='children'>
    <li class="page_item>subpoint 1</li>
    </ul>
    </li>
    </ul>
    </nav>
  • The topic ‘addClass not working’ is closed to new replies.