JSFiddle - React, Tailwind, and code Playground
by hicurin
HTML
<div>
abcd+<span style="color:red;">A6</span>
</div>
<button id="btn">get</button>
JavaScript
$('#btn').click(function(){
sel = document.getSelection();
//posDiv = sel.anchorNode.parent().anchorOffset;
alert('ok');
});