var textArea = document.getElementById("txt_from"); var selecttxt = textArea.value.substr(textArea.selectionStart,textArea.selectionEnd - textArea.selectionStart); alert(selecttxt);