Nick
Nick

Reputation: 129

Can't hide price if it's equals to 0 in Essential Grid Wordpress Plugin

Hi I am Newbie to Javascript and JQuery so sorry if it's a simple issue but i've been trying to solve it for hours and didn't succeeded... :(

I am using Essential Grid Plugin for Wordpress and on each frame of galley picture I have price , some of them are free so the price that shown is $0 what i've been trying to do is to hide this price if its $0;

tried many options that had a right syntax but none of them worked for example :

JQuery(document).ready(function(){
  var amount =  $('.amount').val();
  if(amount == '$0'){
  jQuery('.amount').hide();
});

$amount =  $('.amount').val();
if($amount == '$0'){
 jQuery('.amount').hide();
}

and others,,, but the only thing is worked is this line ...

jQuery('.amount').hide();

All of those i've tried to implement in Essential Grid API/Javascript (special area for javascript) enter image description here

Upvotes: 0

Views: 103

Answers (1)

Pieter21
Pieter21

Reputation: 1845

I have created a jsfiddle to suggest a solution using 'filter()':

https://jsfiddle.net/pqtrz3vm/

jQuery('.amount')
    .filter(function() {return $(this).text() == "$0";})
    .hide();

However I also demonstrated how accurate the match on $0 must be. (You could still apply some text processing)

Upvotes: 2

Related Questions