Edit This Code:
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../lib/w3.css">
<body class="w3-container">

<h2>Toggle Show/Hide</h2>
<p>Click on the button to show/hide a paragraph.</p>

<button onclick="myFunction()" class="w3-btn">Button</button>

<p>Paragraph 1.</p>
<p id="Demo" class="w3-hide">Paragraph 2.</p>
<p>Paragraph 3.</p>

<script>
function myFunction() {
    var x = document.getElementById("Demo");
    if (x.className.indexOf("w3-show") == -1) {
        x.className += " w3-show";
    } else {
        x.className = x.className.replace(" w3-show", "");
    }
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy