JSFiddle - React, Tailwind, and code Playground

HTML

<p>
    This is a test
</p>

JavaScript

$(document).on("click", function() {
    if(!document.getSelection().toString().length) {
        console.log("No selection");
    }
});