<!DOCTYPE html>
<html lang="en-US">
<body>
<h2>CSS Caret Color</h2>
<input type="text" id="point" autofocus>
<button onclick="myFunction()">Click Me</button>
<script>
function myFunction(){
var x = document.getElementById("point");
x.style.caretColor = "red";
}
</script>
<p><strong>Note</strong>: Click on the button and then focus the input.</p> </body>
</html>