JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" value="still there?" onclick="alert((isInDoc(myElement))?'yes':'no')"/>
<hr/>
<strong id="someId" onclick="this.parentNode.removeChild(this)">Here I am, click me to remove me</strong>

JavaScript

function isInDoc(element)
{
  return (document.documentElement.contains(element));   
}
myElement=document.getElementById('someId');