For example :
<span id=1>this is my </span><span id=2>selected text</span><span id=3> but this is not selected</span>
I want to catch the list of span id of the text selected by user with jquery.
In this example i want : [1,2]
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
$(window.getSelection().getRangeAt(0).cloneContents()).children("span")will get you the selected spans. The MDC docs are always a good place to start for this kind of this.