JSFiddle - React, Tailwind, and code Playground

HTML

<div id="first"> 


</div>

CSS

#panel {
    width:200px;
    height:200px;
    background:grey;
}

JavaScript

var panel = $("<div id='panel'></div>");
    var panelBg = $("#panel");

    var test = "true";
    var red  = "true";
    var blue = "true";


    if (test == "true") {
        
            
        if (red == "true") {
                    
           $("#first").prepend(panel);
                    
        }
            
            
    
        if (blue == "true") {
    
           panelBg.css("background-color","red");
      
        }
            
            
   }