As I understood, selectionStart must return start position from selected text in input text or textarea elements
I have this js code
$("#inpt").on("mouseup" , function () {
alert( $("#inpt").selectionStart);
});
and html
<input id="inpt" type="text" value="bla bla bla" />
When I select some part in text "bla bla bla" the result is "undefined". Yell please, where did I go wrong ?
Try this.selectionStart
, it's not the property of jQuery object, but the HTMLInputElement
's property.
$("#inpt").on("mouseup" , function () {
console.log(this.selectionStart);
});