To add a class to an element, you use the classList property of the element.
Get all of an element’s parent elements up the DOM tree
Let’s look at how to get all parent elements of a specific element.
Get the Children of an Element
To get the children of an element, you use the childNodes property of the element.
Get the Parent of an Element
This snippet gets the parent of an element by using the parentNode property of the element.
Selecting Elements By Class Name
To select elements by a given class name, you use the getElementsByClassName() method
Selecting an Element By Id
Select an element that matches the id using the getElementById() method.
This script allows a user to read a volume of text, without having to scroll the page and without having to load different pages. This makes for easier maintenance as only one page needs to be updated, yet the content is visible to search engines. Very useful for large amounts of text.