Reputation: 1644
Should be pretty simple, but I can't seem to find it in Google.
Upvotes: 1
Views: 364
Reputation: 5821
You would use the selectionStart
or selectionEnd
property of the input
element.
setInterval(function(){
console.log([document.getElementById("test").selectionStart, document.getElementById("test").
selectionEnd
------------
]);
}, 1000);
<input type="text" id="test"></input>
Upvotes: 1