Hi everyone,

I'm new to this group and this is my first message.

I am porting over a rich text editor that currently only works in IE.

I have done tons of search about getting the selected text in a page.
I'm very close...for instance...you can now see the formatting buttons
and also I have the correct code to get it to know what is selected and
if you click 'bold' it will put the bold tags around it in a text box.

I want it so that if NOTHING is selected and you hit bold it will give
you an alert box for the text that you would like bolded. Then plance
that text with the bold tags around it. My problem is I can't get the
right code of the DOM to test correctly for a selection being made in
the text box.

I am currently trying

Str = window.getSelection;
If (str.isCollapsed) {
   if true do this;
}else{
    do this;
}

I put alert(str.isCollapsed) in there to trace what is going on but it's
ALWAYS true.

I'm wondering if it's because the text is in a textarea and not just on
the page?

Like I said, I have been getting it to work without sniffing to see if a
selection has actually been made to put the tags around the text but I
can't for the life of me sniff it out through code.

I've also tried 

Str = window.getSelection;
If(str.toString().length > 0) to no avail.

Thanks in advance!

Buddy

******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to