Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Javascript in TypeWriter Effect

$
0
0

I try to create a typeWriter effect using Javascript. It done perfectly, but it cannot type '<' character. I don't know how to fix it

My code is:

let other = document.getElementById('other');let txt = "Hello World <br> this typing effect.";let i = 0;function typeWriter() {    if (i < txt.length) {      other.innerHTML += txt.charAt(i); i++;      setTimeout(typeWriter, 10);      window.scrollTo(0, document.body.scrollHeight);    }}typeWriter();
<h1 id='other'></h1>

I hope the result like:

Hello Worldthis typing effect.

Actual result I get:

Hello World <br> this typing effect.

Please give me some clue. Thanks in advance


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>