<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>The HTMLCollection Object</h1>
<h2>The item() Method</h2>
<p>Click "Change" to change the font size of to all elements with class="myclass".</p>
<button onclick="myFunction()">Change</button>
<p>I am a paragraph.</p>
<p class="myclass">I am a paragraph.</p>
<p class="myclass">I am a paragraph.</p>
<script>
function myFunction() {
const collection = document.getElementsByClassName("myclass");
for (let i = 0; i < collection.length; i++) {
collection.item(i).style.fontSize = "24px";
}
}
</script>
</body>
</html>