I am trying to show or hide a div called "contact-form" on website based on another divs a css class, which is connected to whether a product is in or out of stock.
It needs to show the div if the class is "in-stock", and hide if it's class is "out-of-stock"
any ideas? struggling to figure it out!
<div id="contact-form"></div>
<p class="stock in-stock"></p> <!-- if product is in stock this shows-->
<p class="stock out-of-stock"></p> <!-- if out of stock this show-->
<script>
if ('p.in-stock') {
('#contact-form').show();
}
else {
('#contact-form').hide();
}
</script>
Website is here - http://trent-art.co.uk/shop/barnes-david-still-life-of-flowers/ - out of stock product which needs the "submit best offer" button hiding if out of stock.
HTMLcode also<p>tag?