title: Implementing Delete for Typing Text using example
body: <p>I came across this script in W3 schools for Typing Text. Try as a might, I can't implement a delete function so the user sees text, deletes then 're types. I'm trying to avoid jQuery. Is it also possible to add the text in the html part instead of using a variable?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var i = 0;
  var txt = 'Lorem ipsum typing effect!'; /* The text */
  var speed = 50; /* The speed/duration of the effect in milliseconds */
  
  function typeWriter() {
    if (i &lt; txt.length) {
       document.getElementById("demo").innerHTML += 
       txt.charAt(i);
       i++;
       setTimeout(typeWriter, speed);
     }
   }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p id="demo"&gt;&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>