In a javascript function that I am developing, the user selects some content on a html web page. The content selected can include text, HTML elements, links and images.
Also, the content can start from some portion of one HTMl element, then entire content of some other HTML elements and so on.
I understand how to obtain the Ids of the html elements from which text has been selected.
However, how do I obtain only the portion of text within an HTML element that has been selected (viz. in case user has selected only some portion of content within an HTML Element- i.e. he has not selected the entire content of that element). Also, what is the easiest way to determine if the user has selected partial content or entire content within an HTML element? I would prefer a solution in JQuery but a javascript solution will also be fine with me.