Search⌘ K
AI Features

How it Works: Changing the DOM

Understand how to manipulate the Document Object Model by using JavaScript to update element content with innerHTML, attach event handlers with addEventListener, and change styles dynamically when elements are clicked.

How it works

The marker is added to the heading with this code line:

HTML
title.innerHTML = '<span class="mono">- </span>'
+ title.innerHTML;

Here, title represents the heading. The innerHTML property can be used to access and set the content of an HTML element using textual HTML markup. Most HTML element may nest other markup elements. Although using the DOM operations, you can navigate from a parent element to its child or children. In many situations, it’s ...