JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="foo"></textarea>
<div id="result"></div>
JavaScript
jQuery("textarea").on("input",function(e){
jQuery("#result").append(e.pageY + "<br/>");
jQuery("#result").append(window.getSelection());
});