'How to get parent element of html element with class? [duplicate]

Im building a shopping cart.

I want to loop through a series of html elements with a class "ADD-BTN". Then i want to get the parent element which is a div box for my product sold. Im trying this using for loop.

After looping through them, I want to retrieve a price-tag which is the child of that parent.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source