This is what my data looks like:
<div class="shower">
</div>
<div class="container">
<div class="box">
<div class="hider">
</div>
</div>
</div>
<div class="shower">
</div>
<div class="container">
<div class="box">
<div class="hider">
</div>
</div>
</div>
Onclick of hider I want to hide() .container and show .shower that’s located before closest .container. Onclick of .shower I want to hide .shower that was clicked and show next .container.
How would I achieve this in jquery? Should I restructure my html?
Something like this:
jsFiddle:
Or this if you want to use closest:
jsFiddle: