JSFiddle - React, Tailwind, and code Playground

HTML

<div id="elemento"><span>teste</span></div>

JavaScript

jQuery(document).ready(function () {
   
    //esta é uma alternativa mas pode falhar quando existem espaços em branco dentro da tag
    var test = jQuery("#elemento").html();
    if (test.length <= 0) {
        //elemento vazio.. faça algo
        alert("vazio");
    } else {
        //element possui html dentro...
        alert("não vazio");
    }

    //uma outra alternativa conta apenas os filhos dentro

    if (jQuery("#elemento").children().length <= 0) {
        //vazio
        alert("vazio");
    } else {
        //não vazio...
        alert("não vazio");
    }

    //se for verificar apenas o texto utilize .text() ao invés de .html()
});