I'm trying to write a script in jQuery that would iterate through each text element inside a page. Then I need to change the color of each letter one by one. For example, for a page such as this one:
<p>Some text and <a href="http://example.com">some link</a> and <span>something else</span></p>
I would like to get:
"Some text and "
"some link"
" and "
"something else"
and be able to style each individual letter (i.e. put back into the DOM whatever I styled).
I know about the text()
method but that won't do the job since it combines the text contents, while I need to access each individual text part.
Any suggestion on how to do that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…