<button onclick="myFunction()">Bấm vào</button>
<h2 class="city">Hà Nội</h2>
<p>Hà Nội thủ đô của Việt Nam</p>
<h2 class="city">Paris</h2>
<p>Paris thủ đô của Pháp</p>
<h2 class="city">Tokyo</h2>
<p>Tokyo thủ đô của Nhật</p>
<script>
function myFunction() {
var x = document.getElementsByClassName("city");
for (var i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
}
</script>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.