JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id='tf'>Welcome* to jQuery</textarea>
JavaScript
$("#tf").on('keyup', function(){
var pos = [],
lastOc = 0,
p = $(this).val().indexOf('*',lastOc);
while( p !== -1){
pos.push(p);
lastOc = p +1;
p = $(this).val().indexOf('*',lastOc);
}
console.log(pos);
});