Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get selected text question

Status
Not open for further replies.

jaschulz

Programmer
May 20, 2005
89
FR
I want to get the text currently selected in a document being edited in Google Docs. The following does not do the job (though it works fine in every other context where I have tried it):

var thisText=window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection ? document.selection.createRange().text : null;

What am I missing?

Thanks,

JAS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top