【发布时间】:2022-01-17 17:49:28
【问题描述】:
我有这个类别:
当我按下下拉按钮时,它应该只删除一种类型,但这里它同时删除了 3 种类型。我哪里做错了? 这是刀片:
@foreach($loai as $l => $type)
<ul style="list-style:none">
<li>
<span style="font-size: 17px"><a href="{{URL::to('/loai-san-pham/'.$type->type_id)}}">{{$type->type_name}}</a></span>
<span class="items-sidebar">v</span>
</li>
@foreach($hang as $h)
@if($h->brand_type==1)
<ul class="brand_category">
<li>
<a href="{{route('hangsanpham',$h->brand_id)}}">{{$h->brand_name}}</a>
</li>
</ul>
@endif
@endforeach
<ul class="type_category" style="display: none"></ul>
</ul>
@endforeach
这里是下拉功能:
<script type="text/javascript">
$('.items-sidebar').click(function(){
$(this).parents('ul').find('.brand_category',).toggle();
});
$('.items-sidebar').click(function(){
$(this).parents('ul').find('.type_category',).toggle();
});
刀片或js功能有问题吗?请帮忙..
【问题讨论】:
-
您能否发布在浏览器中显示的下拉列表的 HTML?这样可以更轻松地重现您的问题。
标签: javascript php html laravel