getElementsByTagName
is functioning correctly, but remember that the `fontSize` requires a value of type string
. Additionally, to apply color, you need to use the CSS property 'color'.
function changeStyling() {
var para = document.getElementsByTagName("p");
para[0].style.fontSize = '25px';
para[1].style.color = "red";
}
<p>This is paragraph 1</p>
<p>This is paragraph 2</p>
<p>This is paragraph 3</p>
<p>This is paragraph 4</p>
<p>This is paragraph 5</p>
<p>This is paragraph 6</p>
<p>This is paragraph 7</p>
<button onclick="changeStyling()">
click
</button>