• P...">
    All geek questions in one place

    Add another CSS style to child elements that are also parents

    So my list looks something like this:

    <div="list">
      <ul>
        <li class="page item">Parent 1
          <ul>
            <li class="page item">Child of Parent 1 and Parent of Grandchild
              <ul>
                <li class="page item">Grandchild</li>
              </ul>
            </li>
          </ul>
        </li>
      </ul>
    </div>
    

    This is through Wordpress' list_wp_pages, as well as special CSS CSS code like suckerfish. Nothing can be changed in the disordered list itself, so I need to find a way to add CSS style only to child pages that are also parents (Child of the Parent 1 ...).

    I am trying to add an arrow icon only to child pages that have their own child pages. I realized that I can use:

    $("#target").addClass("newclass"); 
    

    to add an extra class with an arrow icon as a background image.

    Thank!

    +3
    jquery parent children
    Brandt DeLorenzo Oct 31 '08 at 18:00
    source share
    1 answer
    $("#target li").each(function() {
        if ( $("ul:eq(0)", this).length > 0 ) {
            $(this).addClass("class_name");
        }
    });
    

    #target, , , , , .

    +2
    user4903 31 . '08 18:08

    Source: https://habr.com/ru/post/1698984/

    More articles:

    • Design pattern for applying a transform to multiple properties in multiple classes - java
    • How to increase the length of a resolved decorated name in VC9 (MSVC 2008)? - visual-studio-2008
    • detect JSON loaded by browser - json
    • Collection Map - java
    • DBus-Server in Java? - java
    • LastAccess Error - c #
    • .net form windows and Vista font selection - fonts
    • https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1698987/any-disadvantages-to-using-spring-to-separate-tests-and-data&usg=ALkJrhho2i9jZPC1SLs7fWTeOYudqQQYAA
    • How can I do nested Join, Add and Group in LINQ? - c #
    • Can I get line numbers for stack trace on .Net CF 2.0 or 3.5 - .net

    All Articles

    Geek Questions | 2019