i want to get the cursor position's value where started focus to end for this am using
var doIt = function() {
var elem = document.getElementById("mytext");
var start = elem.selectionStart;
var end = elem.selectionEnd;
var selection = elem.selection;
alert("selectionStart: " + start
+ "\nselectionEnd :" + end
+ "\nselection: " + selection);
}
but problem is selectionStart and selectionEnd getting same last value only. how to get properly start and end value example is here http://jsfiddle.net/5vd8pxct/ which i tried