A few lines of code…

This has been messing with me for a long time, so I’m posting here:


seltext = (document.all)? document.selection.createRange() : document.getSelection();
if(seltext!="")
{
alert(seltext);
}

Basically, in my quest to create a WYSIWYG editor that wasn’t huge and unsavory (and worked well on Safari), I have been doing some major hackery. Well, the hackery ends – I can finally just fix it. Thank you Google and months of ignoring the problem!

(and, I finally get ternary operators!)

Leave a Reply