jeudi 23 avril 2015

How can I store the result of a function as an item in an array?

I have some code that returns the contents of a <div> after you press a button. I need to save the result of this function to an array. So how do I do that?

Here's my code so far:

var numKey = document.getElementsByClassName('num-key');

  for (var i = 0; i < numKey.length; i++) {
  numKey[i].addEventListener("click", function () {
    return this.innerHTML;
  });
};

Aucun commentaire:

Enregistrer un commentaire