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() } }) 

jsfiddle


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -