php - javascript / jQuery hide if html equals 0 -
i've built site www.piano-warehouse.co.uk/category/upright-pianos/ using wordpress , have utilised plugin calculating amount of money saved if discount has been applied product. modify setup if no discount has been applied , there no amount saved hide save section. assume javascript or jquery ticket have elementary understanding of these languages , appreciate constructing query.
so far i've tried adding functions file no joy
function you_save_hide () { if ($("span.yousave_list_price").text() == "0") { $("span.yousave_list").hide(); } }
from link can see if $("span.yousave_list_price")
contains dom element
<span class="yousave_list_price"> <span class="amount">some value</span> </span>
so if looking hide span.yousave_list_price
may have this
var _getamountlist = $('.amount'); _getamountlist.each(function(){ // equalizing £0 demo // can use regex fine tune it. if($(this).text().trim() ==="£0"){ $(this).parent().hide() } })
Comments
Post a Comment