I been stuck on this for a full afternoon now.
So I have a webshop that displays a product list, rather than post the code here, I will do it conceptually, to simplify the problem. Hoping someone could point me in the right direction.
I have a list of div classes like the following:
<div class="product-container">
<div class="product-price">Price info</div>
</div>
<div class="product-container">
<div class="product-price">Price info</div>
<div class="production-options">
<select id="selectoptions1" name="product1" class="attribute_list">
<option value="Colour (please select)">Colour (please select)</option>
<option value="White">White</option>
<option value="Navy Blue">Navy Blue</option>
</select>
</div>
</div>
<div class="product-container">
<div class="product-price">Price info</div>
</div>
You will notice that the middle container has a child class production-options. I want to write a JS function that will detect whether a product-container has a child called product-options, If there is, then set the padding of product-price to 20px or whatever.
So javascript would look like this.
if($( ".product-options")) {
$( ".product-price" ).css( "padding-top", "20px" );
}
Now this will affect all the elements with class name product-price, how do I make it so that it will only affect the class product-price with a sibling product-options? (using ID's is not an option, as these are custom fields/attributes generated by virtuemart).