Possible Duplicate:
how can i get cursor position in a textarea?
I want some basic but common operations on textarea with javascript, such as
- get the cursor position
- set the cursor position
- insert some tex开发者_StackOverflow中文版t to the cursor position
- select all text in textarea
- select a range of text
- insert some text to the cursor position, and select it immediately.
I hope it working cross-browers.
Is there such javascript library?
There's a jQuery plug-in I've written that does all of this. There's a standalone version too but it needs a little bit of tidying. If you'd prefer no jQuery then it would give me a reason to sort it out and release it.
精彩评论