One of many JavaScript HTML methods is getElementById()
.
This example uses the method to “find” an HTML element (with id=”demo”) and changes the element content (innerHTML
) to “Hello JavaScript”.
In this example JavaScript changes the value of the src
(source) attribute of an <img>
tag.
Changing the style of an HTML element, is a variant of changing an HTML attribute
Hiding HTML elements can be done by changing the display
style.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.