JSFiddle - React, Tailwind, and code Playground
by jfriend00
HTML
<button id="show">Toggle</button>
<div id="content">
<section id="home">
<h1>Home</h1>
<p>Hi there</p>
</section>
</div>
CSS
#home{
width:250px;
height:100px;
background:#ff6600;
}
#about{
width:250px;
height:100px;
background:#ff0000;
display:none;
}
JavaScript
$(document).ready(function(){
var div = $("<div>");
div.html('<section id="about"><h1>About Us</h1></section>');
$('#content').append(div);
});
$("#show").click(function() {
$("#about").toggle()
});