Winternet

Getting Selected Text from a Textarea Through Javascript in Safari

Filed under: — jwinter on 7/19/2005 at 2:22 pm

Is not possible. Will update this post if shown to be incorrect.

How it’s done in IE:

document.selection.createRange().text will contain your selected text.

How it’s done in Mozilla/Firefox:

//Get the textbox through the DOM
var txta = document.getElementById(’txt’);
//this will contain your selected text
txta.value.substring(txta.selectionStart, txta.selectionEnd));

How it’s done in Safari:

Call Dave Hyatt and ask him what’s selected.

Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


0.088 || Powered by WordPress