Skip to main content


This topic contains 4 replies, has 0 voices, and was last updated by  paperrobots 8 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #32579


    Is there an easier way to select a previous element with jquery rather then chaining .parent().parent().parent()? I have multiple list items that each need individual functionality. So I’m trying to target elements within each one based on the button clicked. What would be the easiest way to target other elements?

  • #47883

    You can use the parents() selector as opposed to the parent() selector to travel up the dom multiple levels. In this case, are you just looking for the list item? Maybe something like:


    @mottie – good call there. Always better safe then sorry.



    Nice I wasn’t aware of .closest! It didn’t work with the .prev() though. So I took it off and it seems to be working.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

icon-link icon-logo-star icon-search icon-star