title: How to access value of a dynamically created text node in a later click event?
body: <p>I have a Javascript project. It's a multiplication table that when click on each cell it should be show the result of that cell.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;meta charset="utf-8"/&gt;
  &lt;style&gt;
      .tdstyles {
          width: 50px;
          height: 50px;
          text-align: center;
      }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="Holder"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;script type="text/javascript"&gt;
  var m;
  window.onload = function () {
      var table = document.createElement('table');
      table.border = 1;
      table.cellPadding = 0;
      table.cellSpacing = 0;
      for (var i = 1; i &lt;= 10; i++) {
          var tr = document.createElement('tr');
  
          for (var j = 1; j &lt;= 10; j++) {
              m = i*j;
              var td = document.createElement('td');
              var newContent = document.createTextNode(m);
              td.className = "tdstyles";
              tr.appendChild(td);
              td.appendChild(newContent);
              document.getElementsByTagName("td").innerHTML = m;
              td.onclick = function () {
                 console.log();
              };
              var a = Math.round(Math.random() * 255);
              var b = Math.round(Math.random() * 255);
              var c = Math.round(Math.random() * 255);
              td.style.backgroundColor = "rgb(" + a + "," + b + "," + c + ")";
  
              // myFunction();
          }
          table.appendChild(tr);
          Holder.appendChild(table)
      }
    };
  &lt;/script&gt;
  </code></pre>
  
  <p>How can I save that TextNode when it is in loop and use it when click on that td?</p>