JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id='tf'>Welcome* to jQuery</textarea>

JavaScript

$("#tf").on('keyup', function(e){
  alert(String.fromCharCode(e.which)); 

    console.log($(this).val().indexOf('*'));
    console.log($(this).val().length - 1);

});