Trying to change the text of all points having a class name as child.
Tried the below code but it is not changing.
function myFunction() {
document.getElementsByClassName("child").innerHTML = "Milk";
}
<!DOCTYPE html>
<html>
<body>
<ul class="example">
<li class="child">Coffee</li>
<li class="child">Tea</li>
</ul>
<button onclick="myFunction()">Click here!</button>
</body>
</html>