用户登录
用户注册

分享至

如何选择具有特定文本的所有锚标记

  • 作者: 万箭穿逼
  • 来源: 51数据库
  • 2022-10-20

问题描述

给定多个锚标签:

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

如何选择与类匹配并带有一些特定文本的锚点.例如选择所有具有类的锚点:'myclass' 和文本:'My Text'

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'

推荐答案

$("a.myclass:contains('My Text')")
软件
前端设计
程序设计
Java相关