Search code examples
jqueryjquery-traversing

Traverse Up multiple times


Currently i use

$(this).parent().parent().parent().parent().$(".collapse");

i tried to use .closest(".playerul") but it didn't find anything. Passing a selector within the parent didn't work out either.
I have to go like this: enter image description here


Solution

  • try this:

    var value = $(this).closest('.playerul').next(".collapse");
    value.hide(); // to hiding 
    console.log(value);