JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="tab">
<button class="tablinks" onclick="openCity(event, 'PageOne')">Page One</button>
<button class="tablinks" onclick="openCity(event, 'PageTwo')">Page Two</button>
<button class="tablinks" onclick="openCity(event, 'PageThree')">Page Three</button>
</div>
<div id="PageOne" class="tabcontent">
<h3>London</h3>
<p>London is the capital city of England.</p>
</div>
<div id="PageTwo" class="tabcontent">
<h3>Paris</h3>
<p>Paris is the capital of France.</p>
</div>
<div id="PageThree" class="tabcontent">
<div id="siteloader"></div>
</div>
</body>
</html>
CSS
body {
font-family: Arial;
}
/* Style the tab */
.tab {
overflow: hidden;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
/* Style the buttons inside the tab */
.tab button {
background-color: inherit;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 10px 10px;
transition: 0.3s;
font-size: 12px;
}
/* Change background color of buttons on hover */
.tab button:hover {
background-color: #ddd;
}
/* Create an active/current tablink class */
.tab button.active {
background-color: #ccc;
}
/* Style the tab content */
/* <button class="tabLinks" onclick="loadURL('http://insider.palaceentertainment.com')">Insider URL</button> */
/* <button class="tabLinks" onclick="loadContent('url_content', 'http://www.msn.com')">MSN</button> */
.tabcontent {
display: none;
padding: 6px 8px;
border: 1px solid #ccc;
border-top: none;
}
JavaScript
function loadContent(id, url) {
var node = document.getElementById(id);
node.innerHTML = url;
}
function openCity(evt, cityName) {
var i, tabcontent, tablinks;
if (cityName == 'PageThree') {
alert("Load External Content");
$("#siteloader").html('<iFrame src="http://validator.w3.org/">');
}
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(cityName).style.display = "block";
evt.currentTarget.className += " active";
}