IE text range selection

A

aqualizard

I have a Content Management SYstem that allows users to modify
code/content through a standard "<textarea>" text box. Sometimes, when
they select text (to copy, delete, etc.) they grab on to partial HTML
tags. This causes confusion and messes up the updates they make.

Is there a way to check a selected text range, and if it has a partial
tag selected, to change the selection automatically to the complete tag
or no tag?

Specifically, upon mouseup when a selection is made, check if the
leftmost and rightmost selections include "><", in which case the
selection will be reduced by 1 char (on whichever side) so the partial
tag is not included.

It only needs to work in IE 5.5+. (Intranet with uniform PC setups.)

I have no problem reading selected text, and determining if it contains
partial tags, the problem is in modifying the selected/highlighted text
in the textarea.

Thank you,
A.L.
 
A

A.L.

Thanks Ivo, I am giving things a shot based on that link.

If anyone has working code for text ranges using moveStart() and
moveEnd() methods that'd be great!

In the mean time, I will see what I can do on my own...

Thanks,
A.L.
 
A

aqualizard

Thanks to Ivo and others I was able to find a working solution. To see
it, follow a thread I started April 1, 2005 in comp.lang.javascript
called:

Changing selected text in textarea

Code samples from Martin Honnen and myself are included in the
thread...

Thanks,
A.L.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top