JSFiddle - React, Tailwind, and code Playground

by jkeyes

HTML

<textarea cols="40" rows="12">Selection is the class of the object returned by window.getSelection() and other methods. It represents the text selection in the greater page, possibly spanning multiple elements, when the user drags over static text and other parts of the page. </textarea>

JavaScript

$('textarea').live('select',function(evt){
    console.log(window.getSelection().toString());
});