Reputation: 161
the code just like this jsfiddle
the code work fine on desktop broswer.
but in android 2.2 or 2.3 browser it has some bugs.
first you use setSelectionRange to set the selection and you can check selectionStart and selectionEnd and it does looks like is work fine.
but it does look like never been set in next time when you check selectionStart or selectionEnd.
Upvotes: 2
Views: 1265
Reputation: 1788
wrapping older android browser's setSelectionRange in a setTimeout with an interval of 0 should work. However it doesn't seem to work with Android 3 or better.
see here: setSelectionRange workaround doesn't work for android 4.0.3
HTH
Upvotes: 3