JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<body>
<div id=div1 style="display:block;">
<p id="intro">Hello World!</p>
<p>This example demonstrates the <b>getElementById</b> method!</p>
</div>
<div id=div2 style="display:none;">
<p id="intro">Hello World again!</p>
<p>This example demonstrates the <b>getElementById</b> method!</p>
</div>
<button type="button" onclick="func()">Change div</button>
<script>
function func()
{
x=document.getElementById("div1");
x.style.display="none";
x1=document.getElementById("div2");
x1.style.display="block";
}
</script>
</body>