How to highlight text using javascript

Can someone help me with a javascript function that can highlight text on a web page. And the requirement is to – highlight only once, not like highlight all occurrences of the text as we do in case of search. Answer You can use the jquery highlight effect. But if you are interested in raw javascript code, take a look at what I got Simply copy paste into an HTML, open the file and click “highlight” – this should highlight the word “fox”. Performance wise I think this would do for small text and a single repetition (like you specified)