title: Why is my textarea value not changing from getDocumentById?
body: <p>My program is supposed to find the frequency of characters in a string, which it does marvelously. However, it only does it from the initial value of a textarea. I need it to update. Any thought? This is homework so if you could keep your answers on the more "guidline style" than the "copy and paste style", that would be much appreciated.</p>
  
  <pre><code>&lt;!DOCTYPE&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;title&gt;THE BEST HOMEWORK EVA!&lt;/title&gt;
          &lt;script type="text/javascript"&gt;
              window.addEventListener("load", start, false);
  
              var string;
              var arr = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
              var freq = [];
  
              function start() {
                  var button = document.getElementById("countButton");
                  button.addEventListener("click", getFrequency, false);
              }
  
              function getFrequency() {
                  string = document.getElementById("inputElement").innerHTML;
                  var totalCharacters = string.length;
                  for (var i = 0; i &lt; 26; i++) {
                      freq[i] = 0;
                      for (var j = 0; j &lt; string.length; j++) {
                          if (string.charAt(j) == arr[i]) {
                              ++freq[i];
                          }
                      }
                  }
                  document.write(document.getElementById("inputElement").innerHTML);
                  //initialize table
                  document.writeln("&lt;table style = \"text-align: center\" border = \"1\"&gt;");
                  document.writeln("&lt;th&gt;Letter&lt;/th&gt;&lt;th&gt;Count&lt;/th&gt;&lt;th&gt;Frrequency&lt;/th&gt;")
                  //construct table by row
                  for (var i = 0; i &lt; 26; i++) {
                      document.writeln("&lt;tr&gt;&lt;td&gt;" + arr[i] + "&lt;/td&gt;");
                      document.writeln("&lt;td&gt;" + freq[i] + "&lt;/td&gt;");
                      document.writeln("&lt;td&gt;" + (freq[i] / totalCharacters * 100) + "%&lt;/td&gt;&lt;/tr&gt;");
                  }
                  //end table
                  document.writeln("&lt;/table&gt;");
              };
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Computer Letter Frequency&lt;/h1&gt;
          &lt;form action ="#"&gt;
              &lt;h2&gt;Input:&lt;input id="countButton" type="button" value="Count!" /&gt;&lt;/h2&gt;
              &lt;p&gt;
                  &lt;textarea id="inputElement" rows="12" cols="80" &gt;Enter your text here....&lt;/textarea&gt;
              &lt;/p&gt;
              &lt;h2&gt;Results:&lt;/h2&gt;
              &lt;div id="outputElement"&gt;&lt;/div&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>