I want to create a typing effect but for only a single element like<p>, not for the entire body of the page, this code snippet works perfectly, but it creates the effect for the entire page, I don't know Javascript.
var str = document.body.innerHTML.toString();
var i = 0;
document.body.innerHTML = "";
setTimeout(function() {
var se = setInterval(function() {
i++;
document.body.innerHTML = str.slice(0, i) + "|";
if (i == str.length) {
clearInterval(se);
document.body.innerHTML = str;
}
}, 10);
});
Thanks for any help you could provide.