Search code examples
javascripthtmlinnerhtmlsquarespace

change innerHTML with text on squarespace


i'm trying to take "sold out" on this page and change it to "coming soon."

right now i have the following but it's not working.

window.onload = function() {
  document.getElementsByClassName("product-mark sold-out").innerHTML = "Coming Soon";
};

Solution

  • window.onload = function(){
         //this captures all the elements with the spec classes
         var soldItems = document.getElementsByClassName('product-mark sold-out');
    
         //this changes each element 1 by 1 to new text
            for(var i=0; i<soldItems.length; i++){
               soldItems[i].innerHTML = "Coming Soon";
            }
    
    }
    

    That should take care of it!