I have a page with a lot of textboxes. When someone clicks a link, i want a word or two to be inserted where the cursor is, or appended to the textbox which has the focus.<
Content Editable, HTML or any other DOM element Selections
If you are trying to insert at caret on a I have had really great luck using the Rangy library: It has a ton of great features such as: The online demo was not working last I checked, however the repo has working demos. To get started, simple download the Repo from Git or NPM, then open ./rangy/demos/index.html It makes working with caret pos and text selection a breeze!