I have user reviews tab on our shop and put image to this in .tab:afterjust to make it more visible. But I want to show this content only when there already is any user review.
Why my code doesn't work?
<script>
$(document).ready(function() {
    if($('.review').length) { 
      $(".tab:after").css("display", "block");
    } 
    else { 
      $(".tab:after").css("display", "none"); 
    }
});
</script>
EDIT: Thank you all! This does the magic:
$(document).ready(function() {
    if($('.review').length >0) { 
        $(".tab").addClass('show-it')
    }
});
CSS:
.tab:after {
    display:none;
    }
.tab.show-it:after {
    display:block;
    }
 
     
     
     
    