I am using the jquery UI dialog ( http://jqueryui.com/demos/dialog/ ) to display a chunk of text. I want to select some text on this dialog box and manipulate it. Now my current code works on Chrome and Firefox but is not working on Safari. (Not tested on IE yet)
I get the selection and display it as follows:
selection = window.getSelection(); alert(selection.toString().length);
Answer: For anyone seeing this... when I used the event "mousedown" instead of "click" in the dialog box on safari it started working. Thanks everyone!
It looks like Safari works a little differently. The getSelection() is not returning a normal string object so not all the string methods work on the object it returns. This link has a work around http://joemaller.com/503/getselection-workaround/
It looks like it is a very old "bug" so there may be better advise on what to do instead out there.