Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- <link rel="stylesheet" href="style.css">
- </head>
- <script>
- function myFunction() {
- var letters = document.getElementById('text');
- for (var i = 0; i < letters.innerHTML.length; i++) {
- //only change the one you want to
- if (i == 4) {
- letters.innerHTML = letters.innerHTML.replace(letters[i], '<span style="color: yellow;">'+letters[i]+'</span>');
- }
- }
- }
- </script>
- <div id="text">
- Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fuga, dolores nostrum! Repellendus recusandae eum maiores incidunt
- cum temporibus, exercitationem sequi fugiat, at accusantium, voluptas fuga.
- </div>
- <script>
- myFunction();
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement