JSFiddle - React, Tailwind, and code Playground
HTML
<div class="mycooldiv">
bunch of text is in here and for example some # and some other cool #
</div>
JavaScript
var $elem = $('.mycooldiv');
var text = $elem.html();
var newText = text.replace(/#/, '<span class="get-position-of-it"></span>');
$elem.html(newText); //Set wrapper
var offset = $(".get-position-of-it").offset();
$elem.html(text) ; //Place back
var topPos = offset.top;
var left = offset.left;
alert(left + ", " + topPos)