gpt4 book ai didi

javascript - 用 squarespace 上的文本更改innerHTML

转载 作者:行者123 更新时间:2023-12-02 16:58:43 24 4
gpt4 key购买 nike

我正在尝试在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com