This works fine and clicking on the <li> opens and closes the inner content <div>.
My issue is that I'm using pagination and when you click on the pagination links to go to the next or previous page, the <div> stays open for a totally new entry on the next or previous page in the same index in the @foreach loop. i.e. If the 3rd item on the page was open before clicking on the pagination link, the 3rd item is also open on the page even though it is a totally different item on the new page.
Any way to make sure all these are closed when you go to the new page?