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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:40:20+00:00 2026-05-11T16:40:20+00:00

For some performance reasons, I am trying to find a way to select only

  • 0

For some performance reasons, I am trying to find a way to select only sibling nodes of the selected node.

For example,

<div id="outer">
  <div id="inner1"></div>
  <div id="inner2"></div>
  <div id="inner3"></div>
  <div id="inner4"></div>
</div>

If I selected inner1 node, is there a way for me to access its siblings, inner2-4 nodes?

  • 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-11T16:40:21+00:00Added an answer on May 11, 2026 at 4:40 pm

    Well… sure… just access the parent and then the children.

     node.parentNode.childNodes[]
    

    or… using jQuery:

    $('#innerId').siblings()
    

    Edit: Cletus as always is inspiring. I dug further. This is how jQuery gets siblings essentially:

    function getChildren(n, skipMe){
        var r = [];
        for ( ; n; n = n.nextSibling ) 
           if ( n.nodeType == 1 && n != skipMe)
              r.push( n );        
        return r;
    };
    
    function getSiblings(n) {
        return getChildren(n.parentNode.firstChild, n);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am trying to squeeze some performance out of this query, any help would be
I'm trying to find proper way to handle stale data on NFS client. Consider
I'm trying to put my assembly in the GAC for performance reasons. It has
I'm trying to migrate graphics in my game to OpenGL for performance reasons. I
All, I'm trying to resolve some performance problems and I've got as far as
I was doing some performance metrics and I ran into something that seems quite
We have some performance problems with one of our applications. I thought about using
I am adding some performance counters to my c# project and am creating a
I'm doing some performance tuning and capacity planning for a low-latency application and have
I am experiencing some performance problems when creating a very simple Python HTTP server.

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.