I am trying to make a div show/hide based on the content of another div. It's a simple thing, but I am new to JS and I just can't seem to figure it out. If the price is "Free", I want the "Dollar" To hide, if it's any number whatsoever, I want it to show.
So we have multiple divs that contain the same thing.
if (document.getElementsByClassName("bookPrice") != null) {
  var price = document.getElementsByClassName("price");
  var priceTag = document.getElementsByClassName("priceTag");
  if ((price.textContent = "Free")) {
    priceTag.style.display = "none";
  } else if (price.textContent != "Free") {
    priceTag.style.display = "block";
  }
}<div class="priceParent">
  <div class="priceTag">$</div>
  <div class="price">Free</div>
</div>
<div class="priceParent">
  <div class="priceTag">$</div>
  <div class="price">60</div>
</div>There's multiple instances of it, and I want them to react according to their own div, not as a whole. Any help is greately appreciated. Thank you.
 
     
     
    