Questions tagged [caret]

Caret refers to an onscreen text-cursor. For the R package, use the [r-caret] tag. For the ASCII character, use the [punctuation] tag.

A caret is a marker in a GUI or command-line denoting the point at which to insert text, often a blinking vertical bar.

Related tags

  • is often used in place of caret (though it can also mean a mouse cursor of database cursor, so caret is preferred).
  • is similar to caret and should probably be a synonym.

Incorrect uses of the caret tag

Please re-tag any questions referring to the package for machine learning as .

Please re-tag any questions about the ASCII punctuation character as .

898 questions
393
votes
8 answers

How to get the focused element with jQuery?

Using jQuery, how can I get the input element that has the caret's (cursor's) focus? Or in other words, how to determine if an input has the caret's focus?
dave
  • 14,991
  • 26
  • 76
  • 110
290
votes
13 answers

How to set the caret (cursor) position in a contenteditable element (div)?

I have this simple HTML as an example:
text text text
text text text
text text text
I want simple thing - when I click the button, I want to…
Frodik
  • 14,986
  • 23
  • 90
  • 141
187
votes
18 answers

Get contentEditable caret position

I'm finding tons of good, cross-browser answers on how to set the caret position in a contentEditable element, but none on how to get the caret position in the first place. What I want to do is know the caret position within a div on keyup. So, when…
Bertvan
  • 4,943
  • 5
  • 40
  • 61
178
votes
4 answers

How to get the caret column (not pixels) position in a textarea, in characters, from the start?

How do you get the caret position in a