rafalry
rafalry

Reputation: 2670

JavaScript detect selection in Android browser

How could I detect in JavaScript in the Android Browser the event when the user selects or changes the selection of some text and elements in the HTML page using JavaScript? Android browser won't dispatch touch end is such situation? Any ideas besides establishing a timer?

Upvotes: 2

Views: 262

Answers (1)

Tim Down
Tim Down

Reputation: 324647

Recent WebKit has the selectionchange event on document. I've no idea if your Android's browser is recent enough, but you could give it a try.

document.addEventListener("selectionchange", function() {
    alert("Selection changed");
}, false);

Upvotes: 3

Related Questions