Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

this.innerHTML in Prototype

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.

like image 652
Danny_Joris Avatar asked Jul 21 '26 04:07

Danny_Joris


1 Answers

Try this:

$$('label.currency').each(function(element) {
    element.update(value);
});
like image 52
Adrian Rodriguez Avatar answered Jul 23 '26 16:07

Adrian Rodriguez