JSFiddle - React, Tailwind, and code Playground
HTML
<div class="my-show-details-list">
Long text <br />
<a name="a2">Show Details</a> <br />
Long text <br />
<a name="a2">Show Details</a> <br />
Long text <br />
<a name="a2">Show Details</a> <br />
Long text <br />
<a name="a2">Show Details</a> <br />
Long text <br />
<a name="a2">Show Details</a> <br />
Long text <br />
<a name="a2">Show Details</a> <br />
Long text <br />
<a name="a2">Show Details</a> <br />
Long text <br />
</div>
<div style="display: inline; position : relative;
float: left;" id="update">
Itemlist1
</div>
CSS
a {
color: blue;
text-decoration: underline;
cursor: pointer;
}
.my-show-details-list{
display: inline;
position: relative;
float: left;
}
JavaScript
$(function() {
$(".my-show-details-list>a").click(function() {
var div = document.getElementById('update');
div.style.top = event.target.offsetTop + "px";
});
});