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

  • Home
  • SEARCH
  • 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 1058125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:58:34+00:00 2026-05-16T17:58:34+00:00

I am searching for a way how I could select a div element which

  • 0

I am searching for a way how I could select a div element which is not the direct next one to the one which is “selected” by a click function.

<div id="click">(siblings)</div><div>text</div><div id="get this one"></div>

Now I would like to select the one with the id “get this one” – in my code this id is not available. All the divs have the same class and do have siblings.
I could select the third one by $(this).next().next() but I think it’s not the best way to do it.
Also there can be divs before the one which is clicked – so it’s not necessarily the first one.

I tried the :nth-child selector but didn’t find a solution.
Later I also may want to select the 13th one after the click one (or the 23th, 65th and so on). This means I would like to have a rather dynamic solution to this problem.

Thanks for your help,
Phil

  • 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-16T17:58:34+00:00Added an answer on May 16, 2026 at 5:58 pm

    You can use .nextAll() with .eq() for your dynamic approach, like this:

    $(this).nextAll().eq(1) //0 based index, this would be .next().next()
    

    This would allow you to get n siblings forward, which seems to be what you’re after.

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

Sidebar

Related Questions

I've been searching for a way to do this, but could not find anything
I'm searching a way to start console application in vim window. So I could
I've tried searching but couldn't come up with a defined way on how to
I am searching for a way to compress JavaScript code for the iPhone. Is
I've been unsuccessfully searching for a way to install make utility on my CentOS
I have been searching for a way to insert linebreaks in my code for
Introduction I've always been searching for a way to make Visual Studio draw a
I'm a NetBeans 6.5 user and am searching for a way of generating a
Im searching for the best way to mantain combo box values within a Mysql
I have been searching high and low for a way to get my silverlight

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.