How to select all anchor tags with specific text

Geoff Appleford picture Geoff Appleford · Mar 15, 2010 · Viewed 62.1k times · Source

Given multiple anchor tags:

<a class="myclass" href="...">My Text</a>

How do I select the anchors matching the class and with some specific text. eg Select all anchors with the class:'myclass' and text:'My Text'

Answer

David Morton picture David Morton · Mar 15, 2010
$("a.myclass:contains('My Text')")