<!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>Clickable Dropdown</h2>
<p>Click on the button to open the dropdown menu.</p>
<div class="w3-dropdown-click">
<button onclick="myFunction()" class="w3-btn">Button</button>
<div id="Demo" class="w3-dropdown-content w3-card-4">
<a href="tryit.asp-filename=tryw3css_dropdown_click.html#">Link 1</a>
<a href="tryit.asp-filename=tryw3css_dropdown_click.html#">Link 2</a>
<a href="tryit.asp-filename=tryw3css_dropdown_click.html#">Link 3</a>
</div>
</div>
<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>