I want to detect if text is highlighted in a textarea only, not the whole document. window.getSelection() works, but I don't want to grab text from any other part of the document that could be highlighted, just what's in the text area.
Basically, I'm trying to do this:
if (document.getElementById("mytextarea").getSelection) {
//do stuff
}
What would be the easiest way to accomplish this? Thanks!