我需要在用户在Android触控设备中选择文本时触发事件。在Web浏览器中,可以通过检查每个鼠标上移事件来触发事件,无论window.getselection是否为null。 触摸选择文本事件不触发。Android上的javascript触发事件选择文本
document.addEventListener('touchend', function(event)
{
if(window.getSelection){
t = window.getSelection().toString();
alert(t);
}
});
我试过touchend event.But当用户选择文本事件没有触发。
你的意思是你需要android代码!? – shareef 2012-08-09 08:59:39
选中此项。 http://stackoverflow.com/a/845438/614807 – 2012-08-09 09:00:03