From f6d1ca72243ad6a14abd9e210257a9aec3aa7aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nacho=20L=C3=B3pez?= <145539062+KrilinZ@users.noreply.github.com> Date: Mon, 3 Aug 2026 14:10:35 +0200 Subject: [PATCH 1/4] docs(readme): rewrite for clarity, SEO and AI answer engines --- README.md | 254 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 201 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 7f4948c..499a22f 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,240 @@ -# Learn The DOM Interactively +
- +# Learn how to manipulate The DOM with JS -> By [@alesanchezr](https://twitter.com/alesanchezr) and [other contributors](https://github.com/4GeeksAcademy/javascript-dom-tutorial-exercises/graphs/contributors) at [4Geeks Academy](https://4geeksacademy.co/) +[![certified by 4Geeks Academy](https://img.shields.io/badge/certified%20by-4Geeks%20Academy-2563eb)](https://4geeks.com/en/interactive-exercise/the-dom-exercises) +[![autograded with LearnPack](https://img.shields.io/badge/autograded-LearnPack-2563eb)](https://github.com/learnpack/learnpack) +[![open in Codespaces](https://img.shields.io/badge/open%20in-Codespaces-fb5a1f)](https://codespaces.new/?repo=4GeeksAcademy/javascript-dom-tutorial-exercises) -![last commit](https://img.shields.io/github/last-commit/4geeksacademy/javascript-dom-tutorial-exercises) -[![build by developers](https://img.shields.io/badge/build_by-Developers-blue)](https://breatheco.de) -[![build by developers](https://img.shields.io/twitter/follow/4geeksacademy?style=social&logo=twitter)](https://twitter.com/4geeksacademy) +![Cover image of the tutorial: the text "Learn The DOM interactive" next to the yellow JavaScript hexagon logo](https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/preview.png) -This tutorial is part of a bigger group of tutorials about web development, this repository focuses only on The DOM. +
-*Estas instrucciones [están disponibles en 🇪🇸 español](https://github.com/4GeeksAcademy/javascript-dom-tutorial-exercises/blob/master/README.es.md) :es:* +*These instructions are [also available in 🇪🇸 Spanish](https://github.com/4GeeksAcademy/javascript-dom-tutorial-exercises/blob/HEAD/README.es.md).* -## You will learn the following concepts: +This interactive tutorial teaches DOM manipulation with vanilla JavaScript across 15 exercise folders: one intro plus 14 auto-graded challenges. You practice `querySelector`, `createElement`, `appendChild`, `innerHTML`, `removeChild`, `childNodes` and `addEventListener`, finishing with a working to-do list. Every graded exercise ships an `index.html`, a `styles.css`, an `index.js`, a bilingual README and a Jest test file. Estimated time: 6 hours. Difficulty: easy. -1. How to select elements from your website. + +## 📋 About this tutorial + ++ **Difficulty:** easy — it is the fourth step of the recommended path listed further down. + ++ **Estimated duration:** 6 hours. + ++ **Exercises:** 15 folders inside `exercises/` — `00-Welcome` (reading only) plus 14 exercises with automatic tests. + ++ **Technologies:** vanilla JavaScript, HTML and CSS. No frameworks, no build step, no `npm install` inside the exercises. + ++ **Grading:** `isolated` — each exercise is graded on its own with Jest running on jsdom. + ++ **Languages:** every exercise has both `README.md` (English) and `README.es.md` (Spanish). + ++ **Solutions:** each of the 14 graded exercises includes a `solution.hide.js` reference file. + + +## 🎯 What will you learn? + +The DOM (Document Object Model) is the bridge between the HTML you write and the JavaScript that changes it while the page is running. By the end of these exercises you will be able to: + ++ Select any element on a page with [`document.querySelector`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) and read its properties, such as `id`. + ++ Change CSS from JavaScript through the `element.style` object (`background`, `float`, and any other property). + ++ Create new tags with [`document.createElement`](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement) and insert them with [`appendChild`](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild). + ++ Build HTML as a string and inject it with [`innerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML) or `document.write`. + ++ Delete elements with `removeChild`, and understand why `childNodes` and `children` do not return the same thing. + ++ React to the user with [`addEventListener`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) for `click`, `change` and keyboard events, updating the page without any refresh. + +If you want the theory behind it first, read [What is the DOM: Document Object Model](https://4geeks.com/lesson/what-is-dom-define-dom). + +## 👀 What will you build? + +`exercises/00-Welcome` is a short introduction with no test. The other 14 folders are graded exercises, each one a tiny website you have to finish: + ++ **`01` Hello World** — write the JavaScript that fires an `alert` saying `Hello World`. + ++ **`02` Select DOM Element** — select the `

` with `querySelector` and alert its `id`. + ++ **`03` Change Div Background** — turn the background of `#myDiv` from green to `yellow`. + ++ **`04` Move DOM Element** — move the `#wulu` div by setting its `float` CSS property to `right` from JavaScript. + ++ **`05` Create DOM Element (1)** — create a `

` with a yellow background and the text "Hello World", then append it to the body. + ++ **`06` Create DOM Element (2)** — insert an `` into the `` using the `innerHTML` property. + ++ **`07` Create DOM list of li** — fill a variable so the body renders a `