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 positions = [];
var $elem = $('.mycooldiv');
var text = $elem.html();
var newText = text.replace(/#/g, '<span class="get-position-of-it"></span>');
$elem.html(newText); //Set wrapper
$(".get-position-of-it").each(function(){
var offset = $(this).offset();
positions.push([offset.left, offset.top]);
});
$elem.html(text) ; //Place back
alert(positions.join('\n'))