JSFiddle - React, Tailwind, and code Playground

HTML

<div contenteditable><em>Edit me</em></div>

CSS

div{margin:14px}
div:focus{background:yellow}
em{font-style:italic;color:#888}

JavaScript

$('div').focus(function() {
    $(this).empty();
    // how to set focus without triggering focus
});