JSFiddle - React, Tailwind, and code Playground

by VivekVish

HTML

<html>
    <head>
    </head>
    <body>
        <div id="content">
            <p>Hello</p>
        </div>
        <div id="clickThis">
            <p>If you click on this or anywhere for that matter after focusing on Hello, you lose your focus on Hello</p>
        </div>
    </body>
<html>

JavaScript

$(document).ready(function()
{
    $('#content')[0].contentEditable=true;
    
    $('#clickThis').bind('click',function(e)
    {
        console.log(window.getSelection().getRangeAt(0).startContainer);
        e.preventDefault();
    });
});