javascript-today

Reading & writing with the DOM I

Reading from elements of the DOM we have selected.

After selecting a piece of the DOM you probably want to do something with it. Before we can do that we have to decide what piece of the DOM element we want to work with.

select an element like this:

let mySelection = document.getElementByID("someID");

then you can interact with it like so:

let someHtml = mySelection.innerHTML;

Next Article: NodeLists