Obtenha texto selecionado JS
// Get highlighted text this way:
window.getSelection().toString()
Tame Toad
// Get highlighted text this way:
window.getSelection().toString()
function disp() {
var text = document.getElementById("text");
var t = text.value.substr(text.selectionStart, text.selectionEnd - text.selectionStart);
alert(t);
}