в html: onclick="uc()" в js: function uc() { setTimeout(function spectext() { var wrapper = document.querySelector(".wrapper"); var text = document.querySelector(".text");
var textCont = text.textContent; text.style.display = "none"; for (var i = 0; i < textCont.length; i++) { (function(i) { setTimeout(function() { // Created textNode to append var texts = document.createTextNode(textCont[i]) var span = document.createElement('span'); span.appendChild(texts);
onclick="uc()"
в js:
function uc() {
setTimeout(function spectext() {
var wrapper = document.querySelector(".wrapper");
var text = document.querySelector(".text");
var textCont = text.textContent;
text.style.display = "none";
for (var i = 0; i < textCont.length; i++) {
(function(i) {
setTimeout(function() {
// Created textNode to append
var texts = document.createTextNode(textCont[i])
var span = document.createElement('span');
span.appendChild(texts);
span.classList.add("wave");
wrapper.appendChild(span);
}, 200 * i);
}(i));
}
} , 3000 , -1);
}
// конец js
И как сделать так чтобы при только одном нажатии на кнопку срабатывал js?