how to insert text into middle of textarea

R

Rick Csucsai

Here is my dilemma: I have a text area where a user will type in a story. I
want them to be able to hit a button that will insert some text (reference
to an image that I will later parse) into the textarea at the point of the
cursor. Granted, this is easy enough to add something at the end of the text
that the user has already typed but what if I want to insert it into the
middle of pre-typed text. For example:

the user types paragraph 1. Then types paragraph 2. They then decide that
they wanted to insert the image into the middle of paragraph 1. I need for
them to be able to click where they want the insert at in paragraph 1, hit
the insert button, and then once the insert is done, they can continue
typing from where they clicked in paragraph 1.

So how can I tell where the cursor (some call it the caret) is within the
text area? Anyone have any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top