Ho risolto così:
dove 'note' è l'id della textareacodice:var txtarea = document.getElementById("note"); var inizio = txtarea.selectionStart; var fine = txtarea.selectionEnd; var sel = txtarea.value.substring(inizio, fine); alert(sel+" inizio="+inizio+" fine="+fine);