On 12 Feb, 07:46, duggoff <[EMAIL PROTECTED]> wrote:
> I have a textarea and a button that allows me to select some text and
> apply a span and class to it. What I need to do is select that text
> later and remove the span and class by clicking on a button. I think I
> can handle to part that removes the span and class, but I don't know
> how to get the selected text after I've highlighted it. Can anyone
> help me?

hi, unfortunately I can't help... Mr. David Flanagan suggests this
function

function getSelectedText() {
        if (window.getSelection) {
                return window.getSelection().toString();
        }
        else if (document.getSelection) {
                return document.getSelection();
        }
        else if (document.selection) {
                // this is specifically for IE
                return document.selection.createRange().text;
        }
}

but it won't get the text inside the textarea in FF and I don't know
why :|

Reply via email to