JSFiddle - React, Tailwind, and code Playground

HTML

<textarea>Some text</textarea>
<textarea>Some text more text</textarea>
<div></div>

JavaScript

$("textarea").select(function() {
    $("div").text("Something was selected");
});

$("textarea").on("blur keydown mousedown", function() {
    $("div").text("");
});