Reputation:
I'm trying to pick up the selected text of a document in a bookmarklet. How do I implement this?
I got this from the internet. Why does this not work?
javascript: Q=document.selection?document.selection.createRange().text:document.getSelection(); alert(Q);
Thanks!
Upvotes: 0
Views: 173
Reputation: 71930
You have to select text first. It alerts selected text in the page. If you just put that code in your address bar in alerts null because no text is selected.
Upvotes: 2