我正在尝试在 this page 上“售完”并将其更改为“即将推出”。
现在我有以下内容,但它不起作用。
window.onload = function() {
document.getElementsByClassName("product-mark sold-out").innerHTML = "Coming Soon";
};
最佳答案
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";
}
}
应该可以解决这个问题!
关于javascript - 用 squarespace 上的文本更改innerHTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25954728/