JSFiddle - React, Tailwind, and code Playground
HTML
<a href="http://example.com" onclick="myFunction(this.href,this.textContent)">
My link
</a>
JavaScript
function myFunction(getAttr,text){
console.log(getAttr,text);
}
<a href="http://example.com" onclick="myFunction(this.href,this.textContent)">
My link
</a>
function myFunction(getAttr,text){
console.log(getAttr,text);
}