I'm not sure which version of Android this will work on, but you should try using the Selection Object . I tried it on 4.3 and it looks like it does what you need.
As a note, although the following warning is indicated on the page:
This is an experimental technology.
Since this technology specification has not stabilized, check the compatibility table for the correct prefixes for use in different browsers. Also note that the syntax and behavior of experimental technology may change in future versions of browsers as the specification changes.
Unfortunately, the mentioned link of the compatibility table does not lead anywhere. Here is a link to the Browser Compatibility Table for window.selection , which, unfortunately, is also not useful.
Here is an example:
HTML:
<strong>Text to select</strong> <button onClick="selectText();">Select</button>
JavaScript:
function selectText() {
I hope this helps.
Faris source share