JSFiddle - React, Tailwind, and code Playground
HTML
<div class="txt"> <p>hi </p></div>
JavaScript
var txt = document.getElementsByTagName("div")[0].innerHTML; if (txt != null ) { document.write("There is content in that div"); } else { document.write("There is NO content in that div"); }