Although you could just use the selectionchange event to show your โaction barโ along with your own functionality, if you want to โreplaceโ the native behavior, you need to either fake all selections from scratch or use selectionchange , and in the second, select the selected text , for example, with a colored span element and canceling the real choice (showing your action bar), the problem with this method will be that 1) your own action screen can be displayed for a split second and 2) the experience will be different from what the user l uses for the possible presence of hazardous effects. If, on the other hand, you want to make a selection from scratch, you should use the user-select css property to disable text selection and the next result based on the touch screen, and you want the text to โselectโ (at color intervals) (realistic only possible in an extremely controlled environment (for example, a text-only reader application)).
Please note that this will not work in Firefox and Opera, since the selectionchange event does not fire there, and you will need to use the touchend event touchend on the + document, stopping bubbling of all other touchhend events to support mobile and firefox mobile opera. (Credit for select not working and selectionchange should be used for Tim Down)