JSFiddle - React, Tailwind, and code Playground

HTML

<div id="content" contenteditable="true"> Here are <span class="words" id="some">some</span> words </div>

CSS

.words { color: red;}

JavaScript

//$('.words').hover(function() { $(this).remove(); });
$('.words').click(function() { $(this).remove(); });
//$('.words').on(function() { $(this).remove(); });
//$('.words').onkeypress(function() { $(this).remove(); });
//$('.words').bind("keydown", function(e) { $(this).remove() });