Exception
Exception

Reputation: 8379

How to keep old highlights when calling window.find() again

If I use the below code I am able to highlight the found text in Window.

 window.find(str);

But if I search for another string with window.find() the previous highlight will be removed. But how can I change that to not remove old highlights..

Upvotes: 1

Views: 787

Answers (1)

Tim Down
Tim Down

Reputation: 324617

You can use document.execCommand() to add styling to the current selection after calling window.find(). See my answer here, for example:

https://stackoverflow.com/q/5887719/96100

Upvotes: 1

Related Questions