0

Make a cool rainbow highlight effect for text using JavaScript

I want the letters of a certain text on my webpage to change colours one by one but before one letter changes colour, the previous letter must return to it's normal state. In a nut shell, each letter of the word must get highlighted in a certain colour IN TURN. Could you please refer me to a code or design one. Any help will be greatly appreciated. Thanks in advance!

12th Jul 2021, 4:34 PM
Odd Brain
Odd Brain - avatar
3 Réponses
+ 5
use JavaScript. 1.Get div by its id, 2.Get it's value to any var 3.Use loop and add each letter to sibling div inline-block 4.one by one change color of every sibling to highlited color others to default 5. Run code on hover
12th Jul 2021, 4:57 PM
Shadoff
Shadoff - avatar
+ 1
sorry, can't. you have to do it alone
14th Jul 2021, 10:56 AM
Shadoff
Shadoff - avatar
0
@shadoff thank you for answering, I am but rusty on DOM could you please elaborate on point 3 and 4
14th Jul 2021, 10:06 AM
Odd Brain
Odd Brain - avatar