2.0.3 • Published 5 years ago

caret-xy v2.0.3

Weekly downloads
757
License
MIT
Repository
github
Last release
5 years ago

Viewport-based (fixed) caret position for HTML input and textarea elements. This project is based on textarea-caret-position.

npm i caret-xy

or

yarn add caret-xy

API

caretXY(element, position)
  • element input or textarea DOM element.
  • position is an integer indicating the location of the caret (defaults to element.selectionEnd).

Sample

import caretXY from 'caret-xy'

const input = document.querySelector('input')
caretXY(input)

Known Issue

  • Does not work properly for <input type="email"/>, <input type="password"/> (element.selectionEnd always returns null).
2.0.3

5 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago