Right now, I'm selecteing the first character (a) of the first word inside the text area like this:
<textarea ref="inputEl">abc def ghi</textarea>
methods: {
setInitialCursorPosition () {
const inputEl = this.$refs.inputEl
inputEl.focus()
inputEl.setSelectionRange(0, 1)
}
},
mounted () {
this.$nextTick(() => {
this.setInitialCursorPosition()
})
}
}
w
var str = document.getElementById("textarea").value;
var match = str.match(/\b(\w)/g);
var first = match.join('');
console.log(first[1]);
<textarea id="textarea" ref="inputEl">abc def ghi</textarea>