JSFiddle - React, Tailwind, and code Playground
HTML
<div id="foo">
<p>This is foo</p>
</div>
CSS
.barClass {color: red;}
JavaScript
$(function() {
// The appropriate approach is to set className
var $bar = $('<p>', {
id: 'bar',
innerHTML: 'This is the bar paragraph',
className: 'barClass'
});
console.log('Bar made!', $bar);
$bar.appendTo('#foo');
});