I am trying to write a script in jQuery that will go through every text element inside the page. Then I need to change the color of each letter one by one. For example, for a page such as this:
<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 stylize each individual letter (i.e. return it back to the DOM, whatever I call).
I know about the text()
method, but this will not do the job, because it combines text content, while I need to access each individual text part.
Any suggestion on how to do this?
source share