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:
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);
setTimeout(typeWriter, speed);

Leave a Comment

Your email address will not be published.