One of many HTML methods is getElementById().
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