I started to learn JavaScript today. Sorry for easy question.
I don't understand the logic of getElementsByClassName. Here is my example code, I want to change onclick the the second content but when I click the button nothing is change.
<!DOCTYPE html>
<html>
<body>
<h2>What Can JavaScript Do?</h2>
<p class="demo">JavaScript can change HTML content.</p>
<p class="demo">This is the second content which I want to change.</p>
<button type="button" onclick='document.getElementsByClassName("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>
</body>
</html>