0
<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?

1 Answer 1

3

You can use the jQuery Contains selector https://api.jquery.com/contains-selector/

$("a:contains('X1')")

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.