I want to make this span hide if value === 0
<span class="amount">0</span>
Then i make mini-cart-remove.js
and added to header.
This is my code:
(function($) {
$(document).ready(function() {
if ($('.amount') === 0 ) {
$('.amount').hide();
}
});
})(jQuery);
But can't hide the span.
What i am doing wrong?
You have to get the text in the span and then compare it to 0, for this you can use .text()
If you want have multiple spans you'll have to loop through them to hide them