JSFiddle - React, Tailwind, and code Playground

by ipr101

HTML

<textarea id="text"></textarea>
<input type="button" id="butt" value="click" onclick="check()"/>

JavaScript

function check() {

var textComponent = document.getElementById('text');

alert(document.selection)
alert(textComponent.selectionEnd)
    }