Click a Link Using jQuery based on the Text Inside the Link
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');
精彩评论