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

How to select all anchor tags with specific text(如何选择具有特定文本的所有锚标记)
本文介绍了如何选择具有特定文本的所有锚标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

给定多个锚标签:

<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')")

这篇关于如何选择具有特定文本的所有锚标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
How do I make a TextGeometry multiline? How do I put it inside a square so it wraps like html text does inside a div?(如何制作 TextGeometry 多线?如何将它放在一个正方形内,以便它像 html 文本一样包裹在 div 内?) - IT屋-程序员软件开发技术分享社
ExecJS::ProgramError: SyntaxError: Reserved word quot;functionquot;(ExecJS::ProgramError: SyntaxError: 保留字“function)
Infinite scroll and will_paginate appending the #39;next page#39; of items multiple times(无限滚动和 will_paginate 多次附加项目的“下一页)
What is cleanest way to turn Array of JQuery Promises into a JQuery Promise of an Array?(将 JQuery Promise 数组转换为数组的 JQuery Promise 的最简洁方法是什么?)