Help Needed: Livewire Collapsible Sections Not Working as Expected #12841
Unanswered
abbasmashaddy72
asked this question in
Help
Replies: 1 comment
-
|
You need and id on the section |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Package
Other
Package Version
v3.2.0
How can we help you?
I want to create a dynamic collapsible section using Livewire and Alpine.js, but it's not working as expected. Here is what I'm trying to achieve:
Livewire Component
I have a Livewire component that manages the state of which section is open. By default, section 1 is open. The
toggleSectionmethod should open the clicked section and close any other open section.Blade Template
I have a Blade template that dynamically generates sections. Each section should toggle its visibility when clicked. Here is the code for the Blade template:
Problem
The current behavior is not as expected. When I click on one section, it opens, but clicking on another section doesn't close the previously opened section correctly. Specifically:
I want the behavior to be such that only one section is open at a time, and clicking on an already open section closes it. Any guidance on how to achieve this correctly would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions