Skip to content
Advertisement

multiple iron-collapse not working, expands only first

I’m trying to create multiple iron-collapse elements with content inside. I want the iron-collapse to expand when user clicks on a button. The problem is that I can’t get each element expanded individually. The script catches only first element and does not affect the others. I’ve tried many code samples but without success. Can someone help me? My code is below:

JavaScript
JavaScript

I want only one collapse to expand after it’s corresponding button is being pressed. Is there way to change this code to achieve what I need, without complete rewrite, because only with this code iron-collapse works properly and changes its attribute expanded=”yes/no”, which I later use with cookies?

Advertisement

Answer

Update Ok, i found proper solution after reading some forums and js docs, i will write it down, maybe someone needs it too.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement