Reputation: 399
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
.
Upvotes: 3
Views: 3902
Reputation: 31
$$('label.currency').invoke('update',value);
IE shows very poor performance when replacing complex 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');
Upvotes: 2
Reputation: 3242
Try this:
$$('label.currency').each(function(element) {
element.update(value);
});
Upvotes: 4