/ Published in: JavaScript
This function returns the text that the user currently has selected.
Expand |
Embed | Plain Text
function getSelectedText(){ if (window.getSelection){ txt = window.getSelection(); } else if (document.getSelection) { txt = document.getSelection(); } else if (document.selection){ txt = document.selection.createRange().text; } else return; return txt; }
You need to login to post a comment.
