Modify an Existing Element

Let's see how to use JavaScript to modify a web page once it's been loaded by the browser.

The DOM traversal properties can also be used to update elements in the page.

Example page

Let’s view the text on a page using the HTML code below.

DOM traversal property

HTML content

The innerHTML property can be used to change the content of an element within the DOM. For example, you can add a new language to our list with the code below. We’ll access the ...