How could I use the jQuery :contains() selector within a defined element?

Viewed 58

I want to use the jQuery :contains() selector, but only select elements within a specific element. I'm not exactly sure how to go about it. For better understanding, I want to do something like this:

document.getElementById("main").$("div:contains("Hello World!")");

or

var a = document.getElementById("main");
$("a:contains("Hello World!")");

Except something that actually works.

2 Answers
Related