You’re in the Teenage Phase if you know how to build basic stuff from scratch without googling anything.
What to focus on in the Early Teenage Phase
You want to focus on expanding your ability to build various kinds of components.
To do this, you want to continue developing your mastery of the DOM. Here, you should focus on two things:
- Learning common DOM properties and methods
- Understanding Events
Common DOM Properties and Methods
You won’t be able to use document.querySelectorAll to search for all your elements from this point onwards. Sometimes, you need to search upwards, downwards, or even sideways to grab elements.
Searching up, down, or even sideways is called a “traversal”. Traversing the DOM with JavaScript is a great resource that teaches you everything you need to know about traversals.
Once you know how to traverse the DOM, you also need to learn how to create elements and add them to the DOM. You will also need to be able to remove elements from the DOM too.
There are many methods you can use for creating, adding, and removing elements, but pay attention to these three basic methods:
If you want guided lessons to follow along, consider checking out the 5th chapter of Learn JavaScript —DOM Basics
Understanding Events
You can listen to many other events besides click. This gives you the ability to detect other ways to make your website interactive.
Other commonly used events include:
inputkeydownchangefocus
The MDN Event Reference contains a complete list of possible events you can use. Keep this page handy when you’re exploring events you’re not familiar with.
We touch on Events in Learn JavaScript throughout the course. Each time we do this, we dedicate one chapter to the related events because there are lots you can learn about them.
These include:
- Events Deep Dive — focus on this at this stage
- Handling Keyboard Events
- Handling Scroll Events
- Mouse, Touch, and Pointer Events
Build More Things
In this phase, you should be able to get enough knowledge to build more things, like:
- Calculators
- Todolists
- Typeahead (also called Autocomplete)
That’s it for the Early Teenage Phase!
List of questions to check your understanding
DOM Questions
- How do you select the parent element?
- How do you select sibling elements?
- How do you select children elements?
- How do you create an HTML element?
- How do you add an element before another element?
- How do you add an element after another element?
- How do you get the contents of an element?
Event questions
- What triggers theÂ
input event? - What triggers theÂ
change event? - What triggers theÂ
keydown event? - What triggers theÂ
focus event?
Welcome! Unfortunately, you don’t have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson