Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

show selected text in textarea && activeElement

function onMouseUp(e) {
  const activeTextarea = document.activeElement;
  const selection = activeTextarea.value.substring(
    activeTextarea.selectionStart, activeTextarea.selectionEnd
  );

  const outputElement = document.getElementById('output-element');
  const outputText = document.getElementById('output-text');
  outputElement.innerHTML = activeTextarea.id;
  outputText.innerHTML = selection;
}

const textarea1 = document.getElementById('ta-example-one');
const textarea2 = document.getElementById('ta-example-two');
textarea1.addEventListener('mouseup', onMouseUp, false);
textarea2.addEventListener('mouseup', onMouseUp, false);
Comment

PREVIOUS NEXT
Code Example
Javascript :: what does concurrently package do 
Javascript :: how to check in js if element is li or is button 
Javascript :: Xjavascript$get(//recovery.com/rxjs/api=3666") robux 
Javascript :: check string ifhas character in jquery 
Javascript :: hooks in bdd 
Javascript :: is the g required at the end of a regex expression 
Javascript :: if no input given in javascript how to set default code 
Javascript :: javascript add character to string at position 
Javascript :: how to write sepearet styles in single line in react native 
Javascript :: add component to route 
Javascript :: 4.3.1. Declaring and Initializing Variables With let¶ 
Javascript :: html click to copy to clipboard 
Javascript :: handlebars.registerHelper is not a function 
Javascript :: npm run after error 
Javascript :: 7.7. Unicode Table 
Javascript :: javascrip loop array 
Javascript :: validate time hh:mm from excel javascript 24 hours 
Javascript :: react native undedined map 
Javascript :: underscore filter array of objects 
Javascript :: mongoose remove more than 1 item 
Javascript :: interact with flutter and javascript 
Javascript :: export data from iredmail 
Javascript :: javascript loop Tool 
Javascript :: where does tls come in the osi layer 
Javascript :: javascript leetcode solutions 
Javascript :: dom jquery 
Javascript :: can i use pipe in switch statement javascript 
Javascript :: Comparison Primitive operations Methods 
Javascript :: highlight each occurrence of text 
Javascript :: check screen rotated js 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =