One of many HTML methods is document.getElementById().
This example "finds" the HTML element with id="demo", and changes its content (innerHTML):
This example changes an HTML image, by changing the src attribute of an <img> tag:
Click the light bulb to turn on/off the light
Changing the style of an HTML element, is a variant of changing an HTML attribute:
Please input a number between 1 and 10