Questions tagged [jquery-traversing]

Functions in the Traversing category in the jQuery JavaScript library allow for the selection and manipulation of element(s) based on the function description.

A complete list of supported traversal functions is available at jQuery's API documentation: Traversing. Subcategories of this category are Filtering, Tree Traversal, and Miscellaneous Traversal.

Functions like .children(), .prevAll() and .each() are included in this category.

162 questions
4
votes
2 answers

Why is $("div > div") working differently than $("div").children("div")?

I have a weird problem where I can't use the normal sizzle selector to correctly select something in jQuery: These two lines don't do the same thing. ele.children("div.a >…
Incognito
  • 20,537
  • 15
  • 80
  • 120
4
votes
2 answers

Can I access a name of last used traversing operation in a chain?

I was wondering if it's possible to get to the name of the method that created a current array of elements. I tried to find it in the jquery object itself, but I don't see a place where it could be stored. Try to fill this…
naugtur
  • 16,827
  • 5
  • 70
  • 113
4
votes
1 answer

jQuery - preceding node - no common parent node

Using jQuery I would like to locate a preceding node from a given node. The preceding node and the given node may not have the same parent node! Please check the following fragment:

Some text

Srikanth Vittal
  • 476
  • 7
  • 22
4
votes
1 answer

Traversing through Nested List - jQuery

I'm currently doing some DOM traversal with jQuery, I'm trying to select each element one at a time in #treeList when button is clicked, but once it goes through the second list #innerList, it will select all elements in that list, and continue on…
SPeoples
  • 57
  • 10
4
votes
2 answers

Sorting class with numbers in chronological order

I'm trying to insert div containers with class names into a box with other containers by defining class with numbers. I'm able to get the following to work correctly as long as the markup is already in chronoligical…
Marc P
  • 606
  • 1
  • 11
  • 26
4
votes
2 answers

How select a closest element (must not be a parent of this) using jQuery?

Assume an html document:
  • aaa
  • bbb ...
    ... …
    static
    • 8,126
    • 15
    • 63
    • 89
    3
    votes
    4 answers

    Find closest next element in DOM with jQuery

    In the following example. I would like to find the first .invalid-feedback and .valid-feedback for both items #main and #secondary. Obviously I am interested in the generic case, that's the reason why I wrote a prototype extension for…
    nowox
    • 25,978
    • 39
    • 143
    • 293
    3
    votes
    1 answer

    Returning last executed value to every div generated dynamically

    I am working in wordpress where i have event panel where i have upcoming event detail and i am showing that how much time is left for next or upcoming event. I am getting values dynamically from database and i am managing the time left for upcoming…
    Vicky
    • 982
    • 2
    • 11
    • 28
    3
    votes
    2 answers

    How to wrap DIV tags with different class names?

    Duplicate: How can I add a parent element to a group of paragraph? I have the following HTML blocks repeated in the document
    My first div
    My second div