JavaScript Logo

Add Typewriter Text to your webpage

How to add Typewriter Text to a webpage with some easy javascript.
First let create a div where the text will be displayed:
<p id="typewriter"></p>
Here is the simple JavaScript:
<script>
var i = 0;
var txt = 'I am Typewriter Text. See me type.';
var speed = 50;

function typeWriter() {
if (i < txt.length) {
document.getElementById("typewriter").innerHTML += txt.charAt(i);
i++;
setTimeout(typeWriter, speed);
}
}
</script>
JavaScript,

Leave a Comment

Your email address will not be published.