gpt4 book ai didi

javascript - 原型(prototype)中的 this.innerHTML

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:53:31 26 4
gpt4 key购买 nike

js 代码片段如下:

function currency_change(value) {

// change all currencies on the page
$$('label.currency').each(function() {

this.innerHTML = value;

});
alert(value);

}

我知道 value 是正确的,我知道我正在遍历每个 label.currency 类,但我似乎无法更改这些元素的 innerHTML 值.

我疯狂地用谷歌搜索,但我不知道该怎么做。我怀疑 this 有问题。

最佳答案

试试这个:

$$('label.currency').each(function(element) {
element.update(value);
});

关于javascript - 原型(prototype)中的 this.innerHTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7290784/

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