admin管理员组文章数量:1406060
js code snippet that goes like this:
function currency_change(value) {
// change all currencies on the page
$$('label.currency').each(function() {
this.innerHTML = value;
});
alert(value);
}
I know value
is correct and I know I'm traversing over each label.currency class, but I can't seem to change the innerHTML
values of these elements.
I googled like crazy, but I can't figure out how to do this. I suspect something is wrong with this
.
js code snippet that goes like this:
function currency_change(value) {
// change all currencies on the page
$$('label.currency').each(function() {
this.innerHTML = value;
});
alert(value);
}
I know value
is correct and I know I'm traversing over each label.currency class, but I can't seem to change the innerHTML
values of these elements.
I googled like crazy, but I can't figure out how to do this. I suspect something is wrong with this
.
2 Answers
Reset to default 4Try this:
$$('label.currency').each(function(element) {
element.update(value);
});
$$('label.currency').invoke('update',value);
IE shows very poor performance when replacing plex DOM trees. In such cases remove the inner DOM before updating:
$$('label.currency').invoke('childElements').invoke('invoke','remove');
If it's one single Element you can say:
$('elementID').childElements().invoke('remove');
本文标签: javascriptthisinnerHTML in PrototypeStack Overflow
版权声明:本文标题:javascript - this.innerHTML in Prototype - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744958031a2634476.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论