Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>Change caret-color with JavaScript</h1> <input id="input1" class="custom" value="Custom caret color"> <p>Click the "Try it" button to set the caret-color property to "red":</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("input1").style.caretColor = "red"; } </script> </body> </html>