0

I want to select a word by double clicking on it and then highlight all the findings of that word in that particular portion of page i.e. in that particular div only using jquery. Thanx in advance

5
  • I know there's a question like that here on SO with a great answer. Commented Oct 1, 2012 at 6:51
  • This is a good start stackoverflow.com/questions/12505602/… Commented Oct 1, 2012 at 6:51
  • I am able to select a word by simply double clicking it, then find and highlight all the occurrences of that word in the whole page but I don't know how to highlight in a particular div only. Actually the text in the div is loaded at runtime. Commented Oct 3, 2012 at 6:00
  • Hey @Keyser can u give me the link of that question. Commented Oct 3, 2012 at 6:02
  • No, I can't find it. But I've read it :p So it does exist Commented Oct 3, 2012 at 7:38

1 Answer 1

1

Simple thougts...

Give your div an id, so you can search in that id with jquery.

Get all the text of that div, and split it by an space { }.

now loop throug the text. if it compares to the selected one, make span around it, and set an background on that span...

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.