[thelist] Javascript - Clearing formatting from a text selection

Ann Adamcik daadamcik at yahoo.com
Wed Aug 2 19:45:07 CDT 2006


I'm implementing a feature that will allow users to insert comments into a block of text.  It works by wrapping a text selection in a span tag, and adding a class and title.  So far, so good, (at least with browsers other than Safari...), but I also need to allow users to delete their comments.  

I think I need something like execCommand('RemoveFormat'), but the text is not editable. Does anyone have any ideas on how to go about doing this?

There's a demo page here: http://indigopear.com/lib/selected.html
And the script file is here: http://indigopear.com/lib/selections.js

Thanks very much!

More information about the thelist mailing list