You could do it by first getting the text of the
element, then split the string to an array, cycle through the array in a for
loop, and whenever your iterator i
is even, add span
tags to the current word. Then, just rebuild the string and insert it as the text
property of your
tag.