Answers for "javascript get selected text"

4

get selected text js

// Get highlighted text this way:

window.getSelection().toString()
Posted by: Guest on April-08-2020
0

get text of selected option js

var sel = document.getElementById("box1");
var text= sel.options[sel.selectedIndex].text;
Posted by: Guest on June-22-2021
0

get selected text input javascript

function disp() {
  var text = document.getElementById("text");
  var t = text.value.substr(text.selectionStart, text.selectionEnd - text.selectionStart);
  alert(t);
}
Posted by: Guest on April-20-2021
0

javascript get selected text

const getSelectedText = () => window.getSelection().toString();

getSelectedText();
Posted by: Guest on September-28-2021

Code answers related to "javascript get selected text"

Code answers related to "Javascript"

Browse Popular Code Answers by Language