Style caretColor Property
Example
Set the color of the cursor to red inside an input field:
document.getElementById("input1").style.caretColor = "red";
Try it Yourself »
Description
The caretColor property specifies the color of the cursor (caret) in inputs, textareas, or any element that is editable.
Browser Support
Property | |||||
---|---|---|---|---|---|
caretColor | 57.0 | 79.0 | 53.0 | 11.1 | 44.0 |
Syntax
Return the caretColor property:
object.style.caretColor
Set the caretColor property:
object.style.caretColor = "auto|color|initial|inherit"
Property Values
Value | Description |
---|---|
auto | Default. Browsers uses the currentColor for the caret |
color | Specifies a color to use for the caret. All legal color values can be used (rgb, hex, named-color, etc). For more information on legal values, read our CSS Colors Tutorial |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
Default Value: | auto |
---|---|
Return Value: | A String, representing the caret color of an element |
CSS Version | CSS3 |
Related Pages
CSS reference: caret-color property
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.