I have this text on an input element: BT25 3___ ____ ____ ____.
I need to know the index of the character where I clicked with the mouse. More specific I need to find what is the index of the clicked value?
It need to be functional in IE11.
Use selectionEnd on mouseup event:
document.querySelector("input").addEventListener("mouseup", function(e){
console.log("pos:", this.selectionEnd);
});
<input value="BT25 3___ ____ ____ ____">
There's no compatibility problem, it even works on IE9.
input.selectionStartorinput.selStart?