JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id="mytextarea"></textarea>

JavaScript

var myTextArea = $("#mytextarea");

myTextArea.keyup(function () {

   console.log("The last typed character is at: ", myTextArea.get(0).selectionStart - 1);

});