how can i select exactly "Candy"

48 views Asked by At

How to select a tag which have "Candy" exactly?

<div class="abc">
       <a>Candy</a>
       <a>Candy Chocolate</a>
</div>
1

There are 1 answers

0
Sakshi Sharma On BEST ANSWER
$('//a[.="Candy"]')

It selects only first anchor tag which exactly contains text "Candy"