Questions tagged [siblings]

The term "sibling" refers to a kind of relationship between two items in a tree structure. Two items have the sibling relationship if they both have the same parent.

The term "sibling" refers to a kind of relationship between two items in a tree structure. Two items have the sibling relationship if they both have the same parent. The sibling relationship is most commonly used in reference to elements in document model objects (DOM's) such as XML documents or HTML documents.

In XPath, a language used to address and locate parts of an XML document, the sibling relationship is directly supported by two axis:

  • following-sibling axis refers to all the following siblings of the context node, and
  • preceding-sibling axis refers to all the preceding siblings of the context node

In addition, two more XPath axis support the sibling concept indirectly:

  • the following axis and
  • the preceding axis
732 questions
6
votes
2 answers

Jquery Next/NextAll/NextUntil with count limit

Its really annoying me that I don't know the answer to this, I thought it would be simple. I want to get the next and previous elements from a selected element to a limit (say 2). Here is an example:
  • link 1
  • link 2
  • link…
Mike Oram
  • 765
  • 8
  • 21
5
votes
1 answer

jquery: select all siblings with css left:position greater than left:position of an element

How to select all siblings of an element that are positioned to the right of it via css? fiddle link
Brainache
  • 87
  • 3
  • 7
5
votes
2 answers

Ensure two items are siblings in JS / jQuery

Given the following HTML structure:
the following is false: ($('#a').parent() == $('#b').parent()); //=> false even though: $('#a').parent().children('#b').length; //=>…
abrad45
  • 83
  • 5
5
votes
2 answers

Cross-domain JavaScript code with sibling sub-domains

I have two web applications setups: david.example.com and john.example.com David opens a new window to John: window.open('john.example.com'); John would now like to set an input element back on David: $("#input", window.opener.document).val("Hello…
GateKiller
  • 74,180
  • 73
  • 171
  • 204
5
votes
2 answers

How to use jQuery prevAll() to select nearby text nodes?

I'm getting a text node (node.nodeType == 3) returned from the getSelection range, eg.: var selectionRange = selection.getRangeAt(0); var startContainer = selectionRange.startContainer; This startContainer usually is a text node, eg the following…
Tom
  • 8,536
  • 31
  • 133
  • 232
5
votes
3 answers

jquery. how to get each siblings height?

I think this is very easy question for someone who is more experienced in Jquery. for example we have simple html page with a few divs, and 3 of them have the same css class 'sidebar' Each of this 'sidebar' divs have different content and different…
Akhmed
  • 1,141
  • 4
  • 21
  • 49
5
votes
4 answers

Find closest sibling using jQuery

Given the following DOM
We need to find the closest
  • -Element with data-id="1" to the one with data-id="3" We…
  • Raphael Jeger
    • 5,024
    • 13
    • 48
    • 79
    5
    votes
    5 answers

    is not a sibling in the same RelativeLayout

    Hello I am starting with Android developing. I am just modifying with ECLIPSE an open source example. I have only modified strings.xml and some .png files. In the Android simulator it works perfect but when I try to generate the signed apk file I…
    javier_pelaez
    • 73
    • 1
    • 2
    • 5
    5
    votes
    1 answer

    Make adjacent sibling elements same width using only CSS

    I'm sorry in advance because I cannot show the code/images of what I'm working on due to confidentiality reasons, however I think I can explain it quite simply. I have an

    element that acts as the title to my webpage - this title can change in…

    alex.mo.07
    • 305
    • 5
    • 14
    5
    votes
    3 answers

    jQuery removing an element and its sibling

    I have a table that has an even number of rows. Odd rows are visible and have a delete button in them, even rows are hidden. Delete should remove a pair, the odd row and the hidden even row. The following only removes the odd row. How can I remove…
    Alan Alcock
    • 787
    • 1
    • 11
    • 26
    5
    votes
    2 answers

    CSS sibling selector on class names?

    I am trying to style fourthChildbased on if secondChild exists under parent I thought…
    user2733367
    • 51
    • 1
    • 1
    • 3
    5
    votes
    2 answers

    Getting sibling value of key in a JavaScript object literal

    Does anybody know of there's a way to reference the value of a sibling key in a JavaScript object literal? so use the value of target in the beforeNext() function here: obj: { target: 'li.player a.icon-tag', parent: 'ul#drop_list', …
    5
    votes
    2 answers

    CSS adjacent sibling selectors - IE8 problem

    I am creating a menu system using a UL/LI structure. I'm trying to use sibling selectors for hover/show-sub-menus. I'm using this; #MainMenu li.Sel ul li.HasSub a:hover+ul { display: block; } The UL structure would be something like this;
    Joel
    • 2,185
    • 4
    • 29
    • 56
    5
    votes
    1 answer

    CSS - Sibling selector not working in android?

    This code works fine in Chrome on desktop, but not android stock browser:
    John
    • 32,403
    • 80
    • 251
    • 422
    5
    votes
    4 answers

    CSS navigation list -- next link selector sibling combinator

    I am attempting to create a simple 3d effect on my nav buttons using border colors. My buttons are simply comprised of an unordered list with background color, border colors, and text padding, and of course links, so the links are nested in the…
    table_formatter
    • 115
    • 2
    • 12