Geoff Appleford Geoff Appleford - 2 months ago 10
HTML Question

How to select all anchor tags with specific text

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
$("a.myclass:contains('My Text')")