<a class="item">
<span class="item_label">BIG_1</span>
<span class="acitve-high">...</span>
</a>
<a class="item">
<span class="item_label">BIG_2</span>
<span class="acitve-low">...</span>
</a>
<a class="button-high">...</a>
<a class="button-low">...</a>
How can I achieve the following actions using jquery function?
If the span containing text "BIG_1" has a sibling with class name "active-high" then click button with class name "button-high"
else if span containing text "BIG_1" has a sibling with class name "active-low" then click button with class name "button-low"
In the HTML, the span with text BIG_1 currently has a sibling with class name "active-high". I want the code to always check if this is true and then click a button with class name "button-high" if so. The website is dynamic and so the span with class name "active-high" sometimes automatically changes to "active-low". So, I want the code to click the button with class name "active-low" instead every time this change occurs.
Please note: More than one span has the class name "item_label" so I can't use the class name to identify the span with text BIG_1. Also, I can't use its position either because that changes automatically from time to time as well.