javascript - Avoid jquery function for all the content -
i have table 20 rows. in each row there element
<p class="exp-date">'.$cust->expiration_date.'</p>
this element going repeated , return different values in lot of rows return 0001-01-01. want hide content wrote in javascript
var exp = $(".exp-date").val(); var exphide = '0001-01-01'; if(exp = exphide) { $(".exp-date").html(''); }
and have tried this
$('.exp-date').each(function() { if(exp = exphide) { $(".exp-date").html(''); } });
but in both cases apply jquery on first row , modify not statement declared.
someone idea?
thanks in advance
use == , "this", else point classes. code shown below
var exphide = '0001-01-01'; $('.exp-date').each(function() { if(this.innerhtml == exphide) { //this.innerhtml $(this).html(''); //this.html..else point classes } });
Comments
Post a Comment