From the course: Mastering Web Developer Interview Code

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

How do you manipulate the DOM?

How do you manipulate the DOM?

- [Teacher] The DOM or Document Object Model is one of the most fundamental components of any web application. Now, understanding what a developer knows about reading, writing, and modifying the DOM, is a good way to gauge their level of skill. And it's also important for every developer to understand how to access, modify, and even remove elements within the DOM. So let's take a look at some definitions and then we'll dig into some code. The DOM is the structure that gives you access to all of the content within a website. You can target the DOM with JavaScript and also with CSS rules. Now, the key to accessing these elements inside your HTML are nodes. Think of nodes as a branch and a tree that has different sub-branches. You can access the content of your page by targeting the proper node. So we have the HTML as a node, and if we want it to access the main section or a sidebar, we would target the sidebar element…

Contents