Is there any way to insert a text (string, may or may not have html tags) to a div
?
It has to be a div
and not a textarea
.
First of all, I need to get the cursor position, then insert the text in that position. It's similar to function insertAdjacentText
, but it can only insert before or after a tag, and only works in IE.
Refer to this URL: http://yart.com.au/test/iframe.aspx. Note how you can position the cursor in the div, we need to add text at the cursor location.