f



Javascript Caret Position in DIV - Javascript Clipboard

Hi All,

I am looking for a way to get and set the caret position in an editable DIV.
I have tried using the TextRange option, this is using the
document.selection.createRange() function.  The problem is that the
TextRange object is sometimes shared in memory, and consequently one
modification of the TextRange will affect another.
I am using this to implement a javascript clipboard, so I have to be able to
save the TextRange objects to restore any changes made to the DIV content
when the user hits CTRL Z.

Alternately, does anyone know of a good javascript clipboard?  The default
one does not work for me because I have more than one editable DIV open at a
time, and hitting CTRL Z on one DIV may undo changes on the other DIV.

Many Thanks to all who answer!!

Mike.

mgrishaber@cp.org


0
Mike
8/23/2004 7:29:37 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

1 Replies
1442 Views

Similar Articles

[PageSpeed] 47

Mike Grishaber wrote:

> I am looking for a way to get and set the caret position in an editable
> DIV. I have tried using the TextRange option, this is using the
> document.selection.createRange() function.  The problem is that the
> TextRange object is sometimes shared in memory, and consequently one
> modification of the TextRange will affect another.

Huh?  A (short) example, please.


PointedEars
-- 
You can listen to thunder after lightning and tell how close you came
to getting hit.  If you don't hear it, you got hit, so never mind.
0
Thomas
8/23/2004 9:29:11 PM
Reply: