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
1
vote
1 answer

Function to number paragraphs starting from a sibling

Title 1

paragraph 1

paragraph 2

paragraph 3

Title 2

paragraph 1

paragraph 2

paragraph 3

$('#numPara').bind('click', function(){ var i=0; var bouton =…
1
vote
3 answers

prevAll on hidden elements

Hi i have a hidden div which inside hold other divs Example
...
...
...
...
...
...
...
ntan
  • 2,195
  • 7
  • 35
  • 56
1
vote
2 answers

How to simplify this jquery tree traversal?

HTML ... TEST

First

Second

  • 1
  • 2
  • 3
123
... JS var id =…
Spilarix
  • 1,418
  • 1
  • 13
  • 24
1
vote
2 answers

jquery siblings() getting pervious sibling instead of next

hey guys hope you can help me out. I am relatively new to jquery and having some trouble traversing a table. basically I have this
Ahmed-Anas
  • 5,471
  • 9
  • 50
  • 72
0
votes
2 answers

Traversing an unordered list -jQuery

I have something like this : first level 1 2nd level 1 3rd level 3rd level 2 2nd level 2 first level 2 I want to addClass to all sibling li elements that follow the li elements containing anchor tag…
HalfWebDev
  • 7,022
  • 12
  • 65
  • 103
0
votes
2 answers

Jquery cant traverse elements

I am trying to select .singleAnswer but it's not working. JQUERY: $(".answerContainer").on("click", ".editAnswer", function(e){ e.preventDefault(); answer = $(this).parent('.answerBar').closest('.singleAnswer'); //this variable doenst…
kirby
  • 3,981
  • 14
  • 41
  • 54
0
votes
1 answer

Toggle Open for rows after a particular class name

I am trying to toggle open rows after a particular class. The current script hides all the rows after the class "toggle-open". But what I am looking at is, only hide the rows starting from the adjacent row till the row above the next class…
Sullan
  • 1,147
  • 2
  • 22
  • 39
0
votes
1 answer

jQuery iframe Select Source DOM Element

I need to create a jQuery dialog with an iframe that points to a page under the same domain. I just want a specific ID of that page, not the whole thing. I can't use .load() because there are links on the source page and if someone clicks on them…
kramden88
  • 23,477
  • 3
  • 19
  • 17
0
votes
2 answers

previous first img src - jQuery

i'm trying to obtain the src of an image placed before the link i click:
Lanny
  • 73
  • 1
  • 1
  • 7
0
votes
3 answers

Traversing HTML with jQuery

I am trying to traverse html using jQuery . You can see the html code in the image. when I hover the mouse over a star the code is triggered the code finds the span two levels up using parent().parent(). and then gets all the fa-star elements using…
Thomas Adrian
  • 3,543
  • 6
  • 32
  • 62
0
votes
4 answers

Traversing with jQuery

I have a function that adds a new unordered list item. I'd like to set one of the element's values in the newly created list item to a value that is based on a value in the list item just above the new one. For instance, if I have something…
shawnzizzo
  • 373
  • 4
  • 18
0
votes
2 answers

jQuery: get a reference to a specific element without using id

I'm tinkering a bit with jquery to show a hidden div when a link is clicked. This should be fairly simple, but there's a flaw to it in this case. I have the following markup:

Uge…

bomortensen
  • 3,346
  • 10
  • 53
  • 74
0
votes
1 answer

How to select all siblings child together

I want that if i hover on a div then add abc class in rest div .abc{ color:Red; }

h2

p

h2

0
votes
1 answer

How to select the value of a specific text field when they all have the same class name

I have a table which is generated using a foreach in PHP (Laravel). The table has 3 columns: "Name", "Notes" and "Deactivate". Deactivate is a select with options, "Activate and "Inactive". The "Name" column is made up of a text input field with…
Vince
  • 1,405
  • 2
  • 20
  • 33
0
votes
2 answers

How to search a specific selector through all preceding siblings

When traversing DOM with jQuery, is there an easy way to know how many siblings have a particular class before my selector ? For example with the following HTML :
  • One
  • Two
  • Three
skiplecariboo
  • 842
  • 2
  • 9
  • 21