javascript - Trouble toggling the visibility of multiple divs, since toggle() tracks each element separately -
I have a series of input
buttons, let's say for two simplicity. Each button has its own affiliate content in a separate division. Not all content is to start in invisible divs ( display: any
)
If you click a button, its related content is displayed. If you click it again, the content disappears. This is done with toggle ()
. The problem is that if you click on a button and then click on the second button, then both devices are now visible
then my main question is to solve this problem The best way to do it is to do it. The solution I tried, does not work, so if you have a new perspective, please tell me, or if you can refine my approach to working it, then it would be great to be okay, I tried to solve it
To solve this, I use siblings ()
to make sure that all the contents divs
are invisible first New material divs appear.
So now, if I click on 1 it seems. If I click on 2, 1 disappears and 2 appears ... But now, if I click on 1 then nothing happens (because it's number 1, and toggle ()
is my second click, track each button separately )
How can I apply this type of content toggle without running into these issues ?
(On the real page there is an unknown number
Thank you!
It seems that the answer may be something . Trigger (' Click ')
and : visible
... just have trouble working it .....
Try it out:
Comments
Post a Comment