The contains selector works fine with tags (a:contains()) etc. but doesn't seem to work with $(this). What is the best way to use contains with "this"??
here is my scenario: var matchingText = "Text2"; <ul class="list"> <li><a href="#">Text1</a></li> <li><a href="#">Text2</a></li> </ul> I want to see if the text in matchingText matches text in any of the anchor tags. My goal is to add a class to the anchor tag that has matching text and would like to use the ul.list selector to run through each of the n amount of anchor tags (descendants of ul class "list") I've tried selecting them in-line, or with a .each() loop and each time I cant seem to match using jQuery syntax... Thanks for the help.