• blah
  • blah
  • blah
    Best IT Recipes

    Delete class for all children

    Given the following HTML:

    <div id="table-filters"> <ul> <li class="active">blah</li> <li>blah</li> <li>blah</li> <li>blah</li> </ul> </div> 

    Using table filters as a jQuery selector, how can I remove elements that have CLASS=ACTIVE , no matter what LI it is on?

    thank

    +52
    jquery css-selectors
    AnApprentice Jan 09 '10 at 19:56 2010-01-09 19:56
    source share
    2 answers

    This should work:

     $("#table-filters>ul>li.active").removeClass("active"); //Find all `li`s with class `active`, children of `ul`s, children of `table-filters` 
    +95
    Joel Jan 09 '10 at 19:58 2010-01-09 19:58
    source share

    You can also do the following:

      $("#table-filters li").parent().find('li').removeClass("active"); 
    +25
    insomiac Jun 07 '12 at 1:10 2012-06-07 01:10
    source share


    More articles:

    • $ date + 1 year? - php
    • Best way to store data locally in .NET (C #) - c #
    • PHP myAdmin - Reorder fields (move up or down) - php
    • What is the difference between java and core java? - java
    • How to specify two fields in Lucene QueryParser? - parsing
    • How to exit if condition - python
    • Is there a way to determine if an Android application is signed for production or debugging at runtime? - android
    • Amazon EC2 - Root Instance Storage Device with EBS - cloud
    • Android: automatically selects debug / release Maps v2 api key? - android
    • Guice call initialization method after creating an object - guice

    All Articles

    Geek Cook | 2019