JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wrapper">
<a href="#" class="a1">Anchor</a>
<br />
<br />
<button class="b1">Button1</button>
<p>Scroll this page and click on "Button1" to get the co-ordinated of "Anchor"</p>
</div>
CSS
.wrapper{
height:500px;width:600px;border:1px solid #00ffff;
padding:50px;
}
JavaScript
$(document).ready(function(){
$(".b1").click(function(){
var offset = $(".a1").offset();
alert("(x,y): ("+offset.left+","+offset.top+")");
});
});