开发者

Click a Link Using jQuery based on the Text Inside the Link

开发者 https://www.devze.com 2023-03-19 02:17 出处:网络
How would I go about clicking a link using jQuery, with the text inside the link. I.E.: <a href=\"/node/1744650/nodequeue\">Nodequeue</a>

How would I go about clicking a link using jQuery, with the text inside the link.

I.E.:

<a href="/node/1744650/nodequeue">Nodequeue</a>

I want to click this link based entire开发者_JS百科ly on the fact that Nodequeue is inside the link.


You could use the contains: selector:

$('a:contains("Nodequeue")').click();

For more information about the selector, have a look at the documentation for it here. Please note that it is case-sensitive, if you are looking for case insensitive search, have a look here.


$('a:contains("Nodequeue")').trigger('click');
0

精彩评论

暂无评论...
验证码 换一张
取 消