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');

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


$('#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);
}