Javascript 目标分离div元素

Javascript 目标分离div元素,javascript,jquery,html,css,Javascript,Jquery,Html,Css,当我有多个并且我点击我的按钮时,它会打开表中的所有列表,我不希望这样。我只想在中打开它。 我不知道如何仅使用一个javascript代码来单独定位它 Html代码: <table class="block-IPs-table" id="block-IPs-table"> <thead> </thead> <tbody> <tr class="odd gradeX"> <td class="widht-400

当我有多个
并且我点击我的按钮时,它会打开表中的所有列表,我不希望这样。我只想在
中打开它。 我不知道如何仅使用一个javascript代码来单独定位它

Html代码:

<table class="block-IPs-table" id="block-IPs-table">
<thead>
</thead>
<tbody>
    <tr class="odd gradeX">
        <td class="widht-400 vertical-align-bottom">
            <div class="menu-toggle-left clearfix pull-right">
              <ul class="toggle-left clearfix">
                <li class="">
                    <a href="#"><i class="fa fa-ban active-red fa-2x"></i></a>
                </li>
                <li class="">
                    <a href="#"><i class="fa fa-times fa-2x"></i></a>
                </li>
            </ul>
              <button class="btn btn-toggle btn-left-click" type="button" id=""><i class="fa fa-ellipsis-h fa-2x" aria-hidden="false"></i></button>
            </div><!-- menu toggle -->
        </td>
    </tr>
</tbody>
</table> 
单击其中一个时的图像外观:

要仅切换同一父级中的ul元素,请执行以下操作:

$(".btn-toggle").on('click', function(){
  $(this).closest("div").find("ul").toggle("fast");
});
也就是说,从单击的元素(
this
)开始,向上导航到其包含的div,然后向下导航到ul

在上下文演示中:

$(“.btn toggle”).on('click',function(){
$(此).distest(“div”).find(“ul”).toggle(“fast”);
});

切换
切换
要仅切换同一父级中的ul元素:

$(".btn-toggle").on('click', function(){
  $(this).closest("div").find("ul").toggle("fast");
});
也就是说,从单击的元素(
this
)开始,向上导航到其包含的div,然后向下导航到ul

在上下文演示中:

$(“.btn toggle”).on('click',function(){
$(此).distest(“div”).find(“ul”).toggle(“fast”);
});

切换
切换
可能是您正在寻找的。而不是
menuWrapper.find('ul')尝试使用
menuWrapper.closest('ul')的可能副本可能是您正在查找的。而不是
menuWrapper.find('ul')尝试使用
menuWrapper.closest('ul')可能重复的