[jQuery] how to highlight the selected word and let the server know its parentnode and position?

[jQuery] how to highlight the selected word and let the server know its parentnode and position?


If a word is selected in the page, I want to :
1.highlight it
2.let the server recordes its parentnode and position in the node(such
as it is the nth word in a

) .
I think jQuery can do the 1st point easy, but can it do the 2nd point,
and how?
thanks!