I have a structure like:
<div id="views">
<div id="right-view" class="current-view">
</div>
<div id="front-view">
</div>
<div id="left-view">
</div>
</div>
I want a statement like $(".current-view").next() to behave in such way that if “.current-view” is assigned to the last child (“#left-view”, in this case), the first child is returned (“#right-view”, in this case).
You have to do it yourself, e.g.:
Or if you want to avoid using the “right-view”
idvalue:Live example | Live source: