Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7629291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:48:02+00:00 2026-05-31T05:48:02+00:00

I have a structure like: <div id=views> <div id=right-view class=current-view> </div> <div id=front-view> </div>

  • 0

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).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:48:03+00:00Added an answer on May 31, 2026 at 5:48 am

    You have to do it yourself, e.g.:

    var next = $(".current-view").next();
    if (!next[0]) {
        // No next, use first
        next = $("#right-view");
    }
    

    Or if you want to avoid using the “right-view” id value:

    var current = $(".current-view");
    var next = current.next();
    if (!next[0]) {
        // No next, use first
        next = current.siblings().first();
    }
    

    Live example | Live source:

    $("#theButton").click(function() {
        var current = $(".current-view");
        var next = current.next();
        if (!next[0]) {
            next = current.siblings().first();
        }
        current.removeClass("current-view");
        next.addClass("current-view");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a html structure like : <div onmouseover=enable_dropdown(1); onmouseout=disable_dropdown(1);> My Groups <a href=#>(view
i have html structure like this <div> <span class=ic> <span class=ic>12345</span> </span> </div> i
Ok, I have a structure like this: <div class=image> <img src=img1.jpg alt= /> </div>
I have structure like this <div id=mali_oglasi> <p class=mali_oglas> <span class=name>Predaja7</span> <span class=body>Lorem ipsum
If I have a structure like: <div id=listofstuff> <div class=anitem> <span class=itemname>Item1</span> <span class=itemdescruption>AboutItem1</span>
I have a HTML structure like follows <div id=answer-1> <a class=edit></a> </div> <div id=answer-2>
I have a DOM structure that looks like this: <div id=comment-1234 class=comment>...</div> <div id=comment-2391
I have a html structure like this: <div class=one> <div id=two> <h2>Any</h2> <h4>Any</h4> </div>
I have a div structure like the bottom: <div class=body-content> <div class=col-middle> </div> </div>
I am trying to use jQuery(#element-id).parent().addClass('some-class'); I have a structure something like this: <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.