title: Simulate the look of typing, not the actual keypresses, in javascript
body: <p>I'm trying to write a simple function that will make it appear as though someone is typing in a <code>textarea</code> </p>
  
  <p>-- This is my function (forgive me if its atrocious, but I don't normally use javascript) ---
  The <code>console.log()</code> part works fine, but for some reason I cannot get this script to update the dom the way I would expect...</p>
  
  <pre><code>        function type(string) {
              value = "";
  
              el = document.getElementById("typeArea");
              for (var i = 0; i &lt; string.length; i++) {
                  value += string[i];
                  //$("#fbw &gt; textarea").val(value);
                  el.textContent = value;
                  console.log(value);
                  sleep(160);
              }
              sleep(2000);
          }
  </code></pre>
  
  <p>I appreciate any insight you can give me. </p>