最大3レベルの深さの拡張可能/折りたたみ可能なテキストを可能にするように設計されたWordPressプラグインによって生成されているHTMLがあります。第1レベルまたは第2レベルを折りたたんで、その下の子も展開した場合、それらも折りたたまれますが、私が使用するものではすべての子を選択できないようにしたいと思います。これは私が今まで使っているものです:
$(".hidden-text-toggle").click(function () {
    if ($(".hidden-text:animated").length) return false;
        $(this).next().slideToggle();
        if ($(this).hasClass('expanded') ){     
            $(this).removeClass('expanded');
            $(this).animate({ backgroundColor: "black" , color: "red"});    
        }
        else
        {
            $(this).addClass('expanded');
            $(this).animate({backgroundColor: "red" , color: "black"});
        }
        return false;
    });
<div class="wrapper">
    <h2 class="title">Level One</h2>
    <div class="text" href="#">
        This is level one text.
        <div class="wrapper">
            <h2 class="title" href="#">Level Two</h2>
            <div class="text">
                This is level two text.
                <div class="wrapper">
                    <h2 class="title" href="#">Level Three</h2>
                    <div class="text">                          
                        This is level three text. 
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
4行目の後に何かを置くことでこれが可能になると思っていたでしょ$(this).find(".text").slideUp();うが、どうやら私は間違っています。
どんな助けでも大歓迎です!