Now that you are more comfortable with some programming fundamentals, we can take a deeper dive into the programming interface the browser provides to control the DOM using Javascript.

Working with Element Nodes

Each element on your HTML page has an associated element node in the Document Object Model, or DOM. The DOM can be accessed using Javascript through the document object.

document behaves like any other Javascript object, and has many different properties and methods that are useful in accessing nodes in the DOM.

document.querySelector(selector)

Let’s start with an example:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy