Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get selected text js

// Get highlighted text this way:

window.getSelection().toString()
Comment

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);
}
Comment

javascript get selected text

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

getSelectedText();
Comment

PREVIOUS NEXT
Code Example
Javascript :: js string explode 
Javascript :: get json data into object 
Javascript :: react sign in with linkedin 
Javascript :: how to get os theme value in javascript 
Javascript :: dynamic search bar javascript 
Javascript :: jquery onlcikc css 
Javascript :: invoking jquery validator 
Javascript :: array of arrays to one array js 
Javascript :: comparing two array of objects in javascript returning differences 
Javascript :: react style css image 
Javascript :: how to export module in node js 
Javascript :: Capturing enter in javascript 
Javascript :: how to get selected list item value in javascript 
Javascript :: vue select first option default 
Javascript :: javascript change color 
Javascript :: remove falsy values from array with lodash 
Javascript :: remove first element of array javascript 
Javascript :: javascript escape newline 
Javascript :: How to reset ReactJS file input 
Javascript :: append textarea jquery with value 
Javascript :: change image onclick js 
Javascript :: trigger keyboard event javascript 
Javascript :: sequelize raw query 
Javascript :: onchange on multiple ids jquery 
Javascript :: javascript uppercase function 
Javascript :: javascript trigger function when element is in viewport 
Javascript :: circular queue implementation using js 
Javascript :: array destructuring in react 
Javascript :: check all checkboxes on table 
Javascript :: (error) = { console.log(error); } 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =