Issue
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?
Solution
you need to put the text in the appropriate element, an example:
<input type="text" value="This is some selectable text" onselect="showMsg()" />
function showMsg(){
}
Answered By - Chenga
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.