---
title: "Discussion on \"Highlight all occurrences of text in a container\" | Hashnode"
description: "Discussion on \"Highlight all occurrences of text in a container\". Here is the JQuery code to highlight all occurrences of a given text in a container:\n$(\".container:contains('Google')\").html(function(_, html) {\n  return html.replace(/(Google)/g, '<span style=\"background-color: yellow;\">$1</span>');\n});\nThe above bl..."
url: "https://hashnode.com/posts/highlight-all-occurrences-of-text-in-a-container-5eeb9bb4d18/6125c5ecb115357df05f5125"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Highlight all occurrences of text in a container](https://blog.adarshkonchady.com/highlight-all-occurrences-of-text-in-a-container-5eeb9bb4d18?utm_source=hashnode&utm_medium=feed)

Here is the JQuery code to highlight all occurrences of a given text in a container: $(".container:contains('Google')").html(function(\_, html) { return html.replace(/(Google)/g, '<span style="background-color: yellow;">$1</span>'); }); The above bl...

Dec 10, 2015 · 1 min read · blog.adarshkonchady.com  
Read the article

## Written by

[Adarsh Konchady](https://hashnode.com/@adarshkonchady)

@adarshkonchady · Minnesota, US

  
[View profile](https://hashnode.com/@adarshkonchady)

Interested in all things Web !

As a Senior Principal Engineer at CVSHealth, I specialize in building and optimizing cvs.com to deliver a superior guest experience. Using the latest web technologies, my team and I work diligently to create a user-friendly and intuitive platform that exceeds expectations.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
