How do we target elements using their classes?

How would we change the first element with the class “MENUmenu”.

var Elements = document.getElementsByClassName("MENUmenu"); var Menu = Elements[0]; Menu.innerHTML = "We got to target this element";

This would require some HTML with a class like this:

<html> <body> <p>Some example HTML</p> <div class="MENUmenu"></div> </body> </html>

Related pages