Highlighted

get selected text

Avatar

22-07-2008

given a text field or text input field with following content:

"the fox is brown"



the user selects "fox"



How can I find out in Javascript what the user has selected. I would even accept that the user has to clici a button after selection of a text part to provide an event.



Regards



Martin

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

22-07-2008

I can only give you the complete text ....I cannot give you what the user has selected because any subsequent action (clicking of the button) will de-select the text.