Split Word Into Letter And Get Data Of Each Letter?
I'm hoping this makes sense to someone. It's based a little on the following: How to rotate individual letters. $('.target').html((''+$('.target').html().split('').join
Solution 1:
You can use a plain regular expression replace
for this, without creating any arrays or anything like that:
const target = document.querySelector('.target');
target.innerHTML = target.textContent
.replace(/\w/g, '<span data-glitch="$&">$&</span>');
console.log(target.innerHTML);
<spanclass="target">Ride</span>
Post a Comment for "Split Word Into Letter And Get Data Of Each Letter?"