JSFiddle - React, Tailwind, and code Playground

HTML

<button>hide</button>
<button>show</button>
<button>focus</button>
<br>
<div contenteditable></div>

CSS

div {
    width: 300px;
    height: 300px;
    border: 1px solid black;
    display: inline-block;
}

JavaScript

$('button:eq(0)').click(function() {
    $('div').css("display", "none");
});

$('button:eq(1)').click(function() {
    $('div').css("display", "inline-block");
});

$('button:eq(2)').click(function() {
    $('div').focus();
    
    var range = document.createRange(),
        selection = window.getSelection();
    
    range.setStartAfter($('div').get(0).lastChild);
    
    selection.removeAllRanges();
    selection.addRange(range);
});