Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Lets say i have 3 divs that has been looped i have div1 div2 div3 and for each div i have a button named "Show More", supposedly if i click the show more under div1 the details of div1 should appear, and if i clicked the show more under div2 the details of div2 should appear and if i clicked the show more in div3 the details of div3 should appear.

The problem is this: whenever i clicked show more under each div the details that will appear is div1. how can i make the details of div2 appear if i clicked the show more under it and the details of div3 if i clicked the show more under it.

What I have tried:

@foreach($detail as $detail)
   Title1: {{ $detail->detail1 }}
   Title2: {{ $detail->detail2 }}
   Title3: {{ $detail->detail3 }}
   <button class="btn btn-warning" data-target="#show" data-toggle="collapse">Show More</button>

   <div class="collapse" id="showthis">
      Title4: {{ $detail->detail4 }}
      Title5: {{ $detail->detail5 }}
      Title6: {{ $detail->detail6 }}
   </div>
@endforeach
Posted
Updated 16-Feb-18 9:19am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900