JSFiddle - React, Tailwind, and code Playground

HTML

<div id="result" style="width:50px; height:50px">
</div>

JavaScript

var test = document.createDocumentFragment();
//var test = document.createElement("div"); // This one work

$(test).append($("<div>").html('Hello world!'));


$("#result").append(test);

setTimeout(function(){
    $("#result").children().remove();   
    $("#result").append(test);
    
    console.log('Now test should have been appended');
    $(result).css({"background": "#FF0000"});
},5000)