Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.


JavaScript and the DOM Course

via Treehouse


Limited-Time Offer: Up to 75% Off Coursera Plus!
7000+ certificate courses from Google, Microsoft, IBM, and many more.

JavaScript lets you create interactive web pages which can respond to a user's actions. In this course, you'll learn how to bring web pages to life using the power of JavaScript.

What you'll learn

  • What is the DOM?
  • Making Changes to the DOM
  • Responding to User Interaction
  • Travelling Through the DOM (Traversal)


The Browser Environment

The environment that JavaScript runs in — like a browser, or a server, or even an embedded computer — has a fundamental effect on what it can do. In this stage we'll explore the browser environment, and see how JavaScript can change a webpage right before our eyes.

Chevron 5 steps
  • Welcome and Overview


  • Thinking Globally


  • What is the DOM?


  • Recap


  • The Browser Environment Review

    5 questions

Getting a Handle on the DOM

The first step of making a web page interactive is grabbing ahold of elements you want the user to interact with. This is called selection. There are a number of ways to select elements on a web page. Let's explore those you are likely to use most often.

Chevron 11 steps
  • A Simple Example


  • Select a Page Element By Its ID


  • Selecting by Id

    2 objectives

  • Select All Elements of a Particular Type


  • Selecting Elements with the Same Class Name


  • Selection Review

    5 questions

  • Using CSS Queries to Select Page Elements


  • Selecting Multiple Elements

    1 objective

  • Learning More


  • DOM Selection - More Review

    4 questions

  • Practice Selecting Elements

    3 objectives

Making Changes to the DOM

Once we've selected an element in the DOM, we can read or affect it. We can replace or change the display of text, for example. Or we can create new nodes and insert them into the DOM. Let's learn about and get some practice with some of these actions.

Chevron 11 steps
  • Getting and Setting Text with textContent and innerHTML


  • Changing Element Attributes


  • Modifying Elements

    2 objectives

  • Styling Elements


  • Creating New DOM Elements


  • Style and Element Creation

    5 questions

  • Appending Nodes


  • DOM Manipulation

    3 objectives

  • Removing Nodes


  • Removing an Element from the DOM

    3 objectives

  • Appending and Removing Nodes

    5 questions

Responding to User Interaction

Now we'll get to "teach" an element to behave a certain way when a user interacts with it. For example, we could have a form field turn red if a user enters invalid text. Or a menu could appear if a user clicks on the menu bar. Let's look at these and other behaviors we can set up on a web page.

Chevron 10 steps
  • What is an Event?


  • Functions as Parameters


  • Delaying Execution with setTimeout()


  • Events and Functions as Parameters Review

    5 questions

  • Listening for Events with addEventListener()


  • Adding an Event Listener

    3 objectives

  • Event Bubbling and Delegation


  • Event Listening, Bubbling and Delegation

    5 questions

  • The Event Object


  • Event Delegation

    1 objective

Traversing the DOM

You have your hands on one element, but you want to grab another one nearby. You could go all the way back out to the document and call to it from there, but chances are your node already has a reference to it. Let's learn how to get around in, or traverse, the DOM.

Chevron 11 steps
  • Using parentNode to Traverse Up the DOM


  • Parent Traversal

    2 objectives

  • Using previousElementSibling and insertBefore


  • Traversal Review

    5 questions

  • Challenge: Using nextElementSibling


  • Solution: Using nextElementSibling


  • Sibling Traversal

    1 objective

  • Getting All Children of a Node with children


  • Getting the First and Last Child


  • DOM Traversal - More Review

    5 questions

  • Child Traversal

    2 objectives

Taught by

Guil Hernandez


Start your review of JavaScript and the DOM Course

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.