On the product page I have this element
<span class="product-review-rating"></span>
which represent existing product ratings
and I have this one
<div class="product-detail-trustedshops-reviews" id="ts_product_widget_position" style="clear: both; margin-bottom: 1rem;"> </div>
which I want to remove if first exist
I tried with javascript like this
if (document.contains(document.getElementsByClassName("product-review-rating"))) {
document.getElementsByClassName("product-detail-trustedshops-reviews").remove();
} else {
empty();
}
And I get this error in console
Uncaught TypeError: Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node'. at :1:14
If is possible I can write in jquery too.