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 8233185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:03:01+00:00 2026-06-07T18:03:01+00:00

Technically, this isn’t for a ‘list’ (ul -> li), but for a series of

  • 0

Technically, this isn’t for a ‘list’ (ul -> li), but for a series of div blocks inside a container div. I have tried many different ways to try and achieve this, but none of them work. What happens is that when I get to the last element, and then click on my ‘next button’ it takes me to the SECOND element in the list, never the first element. This is generally the code I’m using:

<div class="wrapperClass">
<div class="myClass" id="ID1">
    <div class="anotherClass">
        <input value="myValue1"/>
    </div>
</div>
<div class="myClass" id="ID2">
    <div class="anotherClass">
        <input value="myValue2"/>
    </div>
</div>
<div class="myClass" id="ID3">
    <div class="anotherClass"">
        <input value="myValue3"/>
    </div>
</div>
...
</div>

and

var nextID = $('div#'+ID).next().find('input').val();
var lastID = $('div#'+ID+':last').find('input').val();

if( nextID == lastID )
{
    nextID = $('.wrapperClass').find('input:first').val();
}
// other code
  • 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-06-07T18:03:03+00:00Added an answer on June 7, 2026 at 6:03 pm

    I realize my mistake(s). I should have written

    if( currentID == lastID )
    {
        // blah
    }
    

    It was also incorrect for me to write

    $('div#'+ID+':last')
    

    Since id’s must be unique. Thanks ‘undefined’ (unnamed person who pointed that out). I’m clearly a newbie.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I guess this isn't technically a code question, but it's something that I'm
Although I have a feeling that this isn't technically possible, it's worth asking anyways.
Ok, so I know that technically this is undefined behavior, but nonetheless, I've seen
I don't think this is technically a macro but I don't know what else
We've got a few common libraries (C# but I guess this isn't platform- or
I have this really strange problem where my entity framework query isn't enumerating correctly.
I know this technically isn't supported (and as far as I can tell it's
I have a javascript class like this (i know it's technically not a class).
I'm aware technically you can't do this as inline always takes president. Inline element
I've read several articles on this issue, and technically speaking, all they end up

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.