简体   繁体   中英

how can i select exactly “Candy”

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

<div class="abc">
       <a>Candy</a>
       <a>Candy Chocolate</a>
</div>
$('//a[.="Candy"]')

它仅选择完全包含文本“ Candy”的第一个锚标签

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM