JSFiddle - React, Tailwind, and code Playground
HTML
<div id="hello">yeah</div>
<div id="status">browser has failed to set range :(</div>
CSS
#hello { display: none; }
#status { color: red; }
JavaScript
var my_range = document.createRange();
var sc = $('#hello').get(0).childNodes[0];
my_range.setStart(sc, 0);
my_range.setEnd(sc, 1);
document.getSelection().addRange(my_range);
$('#status').css('color', 'green').text('has not failed o/');