執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
前往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>