s123
s123

Reputation: 1

Search and highlight text

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

Upvotes: 0

Views: 172

Answers (1)

Mathlight
Mathlight

Reputation: 6653

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...

Upvotes: 1

Related Questions