mardi 28 février 2017

if this class contains, then hide other class content

<div class="product_discountprice" id="product_discountprice1">
    <font color="red">
        <b style="font-size: 20px; font-weight: bold;">VIP Price:
            <p class="listpriceonGrid">List Price</p>
        </b>
    </font>
    <font class="pricecolor colors_productprice">$63.00</font>
</div>

They have this code on the site. You may check the actual site here --> http://ift.tt/2m8HlVV You'll see that some items has VIP Price and List Price, and some items don't have VIP Price. What I would like to do is to hide the "List Price" text if there's a VIP Price on the item, but if there's no VIP Price text, the List Price should be there. Any idea, advices, and help will be much appreciated.

I'm not really good in javascript esp when it comes to if-else. I tried it earlier:

<script type="text/javascript">
$(window).load(function(){
    if ($('.product_discountprice font b:contains("VIP Price:")')) {
        $('.product_discountprice font b p').css("display","none");
    }
});
</script>

but it did not work. So please help.

Aucun commentaire:

Enregistrer un commentaire