Builder field - JS to collapse all other blocks groups when a different block is clicked
Hi all
I have a project with a builder field and I need to automatically expand a block's fields when a block is clicked, as well as collapse all other open blocks at the same time. The idea is that only one block should ever be expanded at a time and I need to do that without the user clicking any "collapse" / "expand" buttons. It needs to happen automatically when a closed block is clicked.
Does anyone know how I could do that? I'm assuming with a little Alpine magic.
2 Replies
I’m sure there’s an alpine way to do it to, but I’m on my phone so tough to give code examples.
@awcodes Thanks, will give this a shot! And if you you think of any ideas re: Alpine solutions I'd love to hear them. The more I can do without hitting the server, the better