JSFiddle - React, Tailwind, and code Playground

HTML

<div id="elem"></div>

JavaScript

$('<div id="div123" style="margin-left:5px;width:180px;background-color:grey;" />').appendTo('#elem');

$('<content456 />').attr({'id': 'content456', 'style': 'margin-left:5px;width:180px;background-color:grey;'}).appendTo('#elem');

var c = document.createElement('content789');
c.setAttribute('id', 'content789');
c.style.cssText = 'margin-left:5px;width:180px;background-color:grey;';
document.getElementById('elem').appendChild(c);


$('#div123').html('this is <b>div123</b>');

$('#content456').html('this is <b>content456</b>');

try {
    $('#content789').html('this is <b>content789</b>');
} catch(err) {
    alert("Caught error: " + err.message);
}