[jQuery] Re: capture user's selection on a html page
On Apr 14, 4:50 am, "ihomest...@gmail.com" wrote: > Thanks for the link. This is pretty nice. Is there a special > javascript even I could capture to get the user's selection? No. The page referenced by Andy uses a mouseup listener on the document. The script itself is not very robust, it's pretty easy to break - create a selection, then create another that includes that selection. It might take a couple of attempts, but it throws an error pretty readily. After that, the script stops working. -- Rob
[jQuery] Re: capture user's selection on a html page
Thanks for the link. This is pretty nice. Is there a special javascript even I could capture to get the user's selection? On Apr 13, 12:46 pm, "Andy Matthews" wrote: > Look into the functionality on the New York Times story > pages:http://www.nytimes.com/2009/04/14/world/asia/14thai.html?_r=1&hp > > Highlight any block of text inside the story, and you'll get a litle popup > question mark icon which links to a search of that string in the NYT > database. > > Pretty handy actually. > > -Original Message- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of ihomest...@gmail.com > Sent: Monday, April 13, 2009 11:36 AM > To: jQuery (English) > Subject: [jQuery] capture user's selection on a html page > > Hi, > > There is an onselect event for javascript which allows you to capture user > selected text in text input or textarea box. Is there a way to capture > user's selection anywhere on the html page? > > I know several javascript applications which allow users to select elements > on a html page and allow you to copy paste your selected html data into > other places. Would appreciate if anyone points me to some references on how > this is implemented, especially how in Jquery. > > Thanks.
[jQuery] Re: capture user's selection on a html page
Look into the functionality on the New York Times story pages: http://www.nytimes.com/2009/04/14/world/asia/14thai.html?_r=1&hp Highlight any block of text inside the story, and you'll get a litle popup question mark icon which links to a search of that string in the NYT database. Pretty handy actually. -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of ihomest...@gmail.com Sent: Monday, April 13, 2009 11:36 AM To: jQuery (English) Subject: [jQuery] capture user's selection on a html page Hi, There is an onselect event for javascript which allows you to capture user selected text in text input or textarea box. Is there a way to capture user's selection anywhere on the html page? I know several javascript applications which allow users to select elements on a html page and allow you to copy paste your selected html data into other places. Would appreciate if anyone points me to some references on how this is implemented, especially how in Jquery. Thanks.