每当我点击相关信息时,我想显示产品的描述,但每次我点击随机信息时,我的代码都会显示所有产品的所有描述。请帮我。
<script type="text/javascript">
$(function () {
$("p.info").on('click', function () {
$("p.desc").slideToggle();
});
});
</script>
// the info and desc of the products are cointaned in:
<div class="products_container">
<ul>
@foreach ($products as $product)
<li>
<div class="products">
@include('helpers/productImg', ['attrs' => 'imagefrm', 'imgFile' =>
$product->image])
<p id="product_name"><strong>{{ $product->name }}</strong></p>
<p>{{ $product->descShort }}</p>
@include('helpers/productPrice')
<p class="info">Info prodotto</p>
<p style="display:none" class="desc">Descrizione: {!! $product->
` descLong !!}</p>
</div>
</li>
@endforeach
</ul>
</div>
眼眸繁星