I have a JS function that needs to extract the heading inside of a div box. The div box contains the button that fires this action. In a previous version of the code, the div just contained a heading, paragraph, and the button. So all I had to do was set the button's class to active and select the previous sibling.
However, the div is beginning to fill up and I'm having to list a lot of previous sibling calls, and it no longer grabs the correct element. Here is the code below: