I have an html file that displays some text. I need to call a JavaScript function when the user selects some text on it. I have the following code but the highlightSelection()
function never gets called.
window.onselect = highlightSelection;
function highlightSelection() {
}
Is there any other way to call a JS function while user selects some text?