Using DOM, JavaScript can perform multiple tasks. It can create new elements and attributes, change the existing elements and attributes and even remove existing elements and attributes. JavaScript can also react to existing events and create new events in the page.
- getElementById, innerHTML Example
- getElementById: To access elements and attributes whose id is set.
- innerHTML: To access the content of an element.