Reputation: 1808
<a href="test1" onclick="calltest1()"> X1 </a>
<a href="test1" onclick="calltest2()"> X2 </a>
<a href="test1" onclick="calltest3()"> X3 </a>
I need to get the hyperlink object based on the text inside ex: x1 and bind a function to it. Can you please suggest the best way to achieve this?
Upvotes: 0
Views: 62
Reputation: 1453
You can use the jQuery Contains selector https://api.jquery.com/contains-selector/
$("a:contains('X1')")
Upvotes: 3