├── exercises ├── 09-Render-on-Click │ ├── styles.css │ ├── img │ │ └── fJk4Rrl.gif │ ├── index.js │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 10-Add-li-on-Click │ ├── styles.css │ ├── img │ │ └── Uv5q1tB.gif │ ├── index.js │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 11-Dynamic-HTML-String │ ├── styles.css │ ├── index.js │ ├── img │ │ └── HpinbLP.png │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 05-Create-DOM-Element-First │ ├── styles.css │ ├── index.js │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 07-Create-DOM-list-of-li │ ├── styles.css │ ├── index.js │ ├── index.html │ ├── solution.hide.js │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 08.1-Remove-DOM-Element │ ├── styles.css │ ├── index.js │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 08.2-Remove-DOM-Element │ ├── styles.css │ ├── index.js │ ├── img │ │ └── LEyjPMW.png │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 06-Create-DOM-Element-Second │ ├── styles.css │ ├── index.js │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── tests.js │ └── README.es.md ├── 13-Todo-List │ ├── index.js │ ├── index.html │ ├── README.md │ ├── solution.hide.js │ ├── README.es.md │ ├── styles.css │ └── tests.js ├── 01-hello-world │ ├── index.js │ ├── solution.hide.js │ ├── styles.css │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 02-Select-DOM-Element │ ├── index.js │ ├── styles.css │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 03-Change-Div-Background │ ├── styles.css │ ├── index.js │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 04-Move-DOM-Element │ ├── index.js │ ├── styles.css │ ├── solution.hide.js │ ├── index.html │ ├── README.md │ ├── README.es.md │ └── tests.js ├── 12-Add-Options-to-the-Select │ ├── index.js │ ├── index.html │ ├── solution.hide.js │ ├── styles.css │ ├── README.md │ ├── README.es.md │ └── tests.js └── 00-Welcome │ ├── README.md │ └── README.es.md ├── preview.png ├── .learn └── assets │ ├── 05.png │ ├── 09-1.png │ ├── 10-1.gif │ ├── 11-1.gif │ ├── 12-1.png │ └── 13-1.gif ├── .gitpod.dockerfile ├── .vscode └── settings.json ├── .gitignore ├── .gitpod.yml ├── .github └── workflows │ └── learnpack-audit.yml ├── LICENSE.md ├── learn.json ├── .devcontainer └── devcontainer.json ├── README.md └── README.es.md /exercises/09-Render-on-Click/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exercises/10-Add-li-on-Click/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exercises/11-Dynamic-HTML-String/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exercises/05-Create-DOM-Element-First/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exercises/07-Create-DOM-list-of-li/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exercises/08.1-Remove-DOM-Element/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exercises/08.2-Remove-DOM-Element/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exercises/06-Create-DOM-Element-Second/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exercises/13-Todo-List/index.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | -------------------------------------------------------------------------------- /exercises/01-hello-world/index.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | -------------------------------------------------------------------------------- /exercises/02-Select-DOM-Element/index.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | -------------------------------------------------------------------------------- /exercises/05-Create-DOM-Element-First/index.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | -------------------------------------------------------------------------------- /exercises/08.2-Remove-DOM-Element/index.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | -------------------------------------------------------------------------------- /exercises/06-Create-DOM-Element-Second/index.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | -------------------------------------------------------------------------------- /exercises/01-hello-world/solution.hide.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | alert("Hello World") 3 | -------------------------------------------------------------------------------- /exercises/02-Select-DOM-Element/styles.css: -------------------------------------------------------------------------------- 1 | #theTitle { 2 | font-size: 22px; 3 | } 4 | -------------------------------------------------------------------------------- /exercises/03-Change-Div-Background/styles.css: -------------------------------------------------------------------------------- 1 | #myDiv { 2 | background: green; 3 | } 4 | -------------------------------------------------------------------------------- /exercises/04-Move-DOM-Element/index.js: -------------------------------------------------------------------------------- 1 | let aux = document.querySelector("#wulu"); 2 | // Your code here 3 | -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/preview.png -------------------------------------------------------------------------------- /exercises/04-Move-DOM-Element/styles.css: -------------------------------------------------------------------------------- 1 | #wulu { 2 | background: blue; 3 | display: inline-block; 4 | } 5 | -------------------------------------------------------------------------------- /exercises/03-Change-Div-Background/index.js: -------------------------------------------------------------------------------- 1 | let myDiv = document.querySelector("#myDiv"); 2 | // Your code here 3 | -------------------------------------------------------------------------------- /.learn/assets/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/.learn/assets/05.png -------------------------------------------------------------------------------- /.learn/assets/09-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/.learn/assets/09-1.png -------------------------------------------------------------------------------- /.learn/assets/10-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/.learn/assets/10-1.gif -------------------------------------------------------------------------------- /.learn/assets/11-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/.learn/assets/11-1.gif -------------------------------------------------------------------------------- /.learn/assets/12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/.learn/assets/12-1.png -------------------------------------------------------------------------------- /.learn/assets/13-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/.learn/assets/13-1.gif -------------------------------------------------------------------------------- /exercises/01-hello-world/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: lightblue; 3 | } 4 | #theTitle { 5 | font-size: 22px; 6 | } 7 | -------------------------------------------------------------------------------- /exercises/11-Dynamic-HTML-String/index.js: -------------------------------------------------------------------------------- 1 | let myString = "

Hello!

My friend, "; 2 | document.write(myString); -------------------------------------------------------------------------------- /exercises/02-Select-DOM-Element/solution.hide.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | let aux = document.querySelector('#theTitle'); 3 | alert(aux.id); 4 | -------------------------------------------------------------------------------- /exercises/04-Move-DOM-Element/solution.hide.js: -------------------------------------------------------------------------------- 1 | let aux = document.querySelector("#wulu"); 2 | // Your code here 3 | aux.style.float = "right" 4 | -------------------------------------------------------------------------------- /exercises/03-Change-Div-Background/solution.hide.js: -------------------------------------------------------------------------------- 1 | let myDiv = document.querySelector("#myDiv"); 2 | // Your code here 3 | myDiv.style.background = "yellow" 4 | -------------------------------------------------------------------------------- /exercises/06-Create-DOM-Element-Second/solution.hide.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | document.body.innerHTML = ``; 3 | -------------------------------------------------------------------------------- /exercises/12-Add-Options-to-the-Select/index.js: -------------------------------------------------------------------------------- 1 | let countries = ["USA", "France", "Italy", "Brazil", "Colombia", "Belize", "Venezuela"]; 2 | 3 | // Your code here 4 | -------------------------------------------------------------------------------- /exercises/09-Render-on-Click/img/fJk4Rrl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/exercises/09-Render-on-Click/img/fJk4Rrl.gif -------------------------------------------------------------------------------- /exercises/10-Add-li-on-Click/img/Uv5q1tB.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/exercises/10-Add-li-on-Click/img/Uv5q1tB.gif -------------------------------------------------------------------------------- /exercises/08.2-Remove-DOM-Element/img/LEyjPMW.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/exercises/08.2-Remove-DOM-Element/img/LEyjPMW.png -------------------------------------------------------------------------------- /exercises/11-Dynamic-HTML-String/img/HpinbLP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/javascript-dom-tutorial-exercises/HEAD/exercises/11-Dynamic-HTML-String/img/HpinbLP.png -------------------------------------------------------------------------------- /exercises/09-Render-on-Click/index.js: -------------------------------------------------------------------------------- 1 | let button = document.getElementById("superDuperButton"); 2 | button.addEventListener("click", function() { 3 | // Your code here 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /exercises/10-Add-li-on-Click/index.js: -------------------------------------------------------------------------------- 1 | let button = document.getElementById("superDuperButton"); 2 | button.addEventListener("click", function() { 3 | // Your code here 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /exercises/11-Dynamic-HTML-String/solution.hide.js: -------------------------------------------------------------------------------- 1 | let myString = "

Hello!

My friend, we are in the year " + new Date().getFullYear(); 2 | document.write(myString); 3 | -------------------------------------------------------------------------------- /exercises/08.2-Remove-DOM-Element/solution.hide.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | let list = document.querySelector('#parentLi'); 3 | let secondLi = list.childNodes[3]; 4 | list.removeChild(secondLi); 5 | -------------------------------------------------------------------------------- /exercises/08.1-Remove-DOM-Element/index.js: -------------------------------------------------------------------------------- 1 | // If you check the HTML, you will find that the second
  • has the id=secondElement 2 | // You can use that to your advantage like a CSS selector 3 | 4 | // Your code here 5 | -------------------------------------------------------------------------------- /exercises/05-Create-DOM-Element-First/solution.hide.js: -------------------------------------------------------------------------------- 1 | // Your code here 2 | let p = document.createElement("p"); 3 | p.innerHTML = "Hello World"; 4 | p.style.background = "yellow"; 5 | 6 | document.body.appendChild(p); 7 | -------------------------------------------------------------------------------- /exercises/07-Create-DOM-list-of-li/index.js: -------------------------------------------------------------------------------- 1 | let beginning = ""; 4 | 5 | // Do not modify after this line 6 | document.body.innerHTML = beginning + listString + ending; 7 | -------------------------------------------------------------------------------- /.gitpod.dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-full:latest 2 | 3 | USER gitpod 4 | 5 | RUN npm i jest@29.7.0 jest-environment-dom@29.7.0 -g 6 | RUN npm i @learnpack/learnpack@2.1.50 -g && learnpack plugins:install @learnpack/dom@1.1.7 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.autoSave": "afterDelay", 3 | "files.autoSaveDelay": 700, 4 | "editor.minimap.enabled": false, 5 | "workbench.editorAssociations": { 6 | "*.md": "vscode.markdown.preview.editor" 7 | } 8 | } -------------------------------------------------------------------------------- /exercises/07-Create-DOM-list-of-li/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Create a DOM list of li 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /exercises/07-Create-DOM-list-of-li/solution.hide.js: -------------------------------------------------------------------------------- 1 | let beginning = ""; 4 | 5 | // Do not modify after this line 6 | document.body.innerHTML = beginning + listString + ending; 7 | -------------------------------------------------------------------------------- /exercises/06-Create-DOM-Element-Second/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CREATE DOM ELEMENT (2nd) 6 | 7 | 8 |
    9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /exercises/08.1-Remove-DOM-Element/solution.hide.js: -------------------------------------------------------------------------------- 1 | // If you check the HTML, you will find that the second
  • has the id=secondElement 2 | // You can use that to your advantage like a CSS selector 3 | 4 | // Your code here 5 | let li = document.querySelector("#secondElement") 6 | li.parentNode.removeChild(li) 7 | -------------------------------------------------------------------------------- /exercises/11-Dynamic-HTML-String/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | DYNAMIC HTML STRING 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything 2 | /* 3 | 4 | !.gitignore 5 | !.gitpod.yml 6 | !.gitpod.Dockerfile 7 | !learn.json 8 | !preview.png 9 | !README.md 10 | !README.es.md 11 | !.vscode 12 | 13 | !/exercises 14 | !/exercises/* 15 | 16 | !/.learn 17 | /.learn/** 18 | !/.learn/resets 19 | !/.learn/resets/** 20 | !/.learn/assets 21 | !/.learn/assets/** 22 | -------------------------------------------------------------------------------- /exercises/09-Render-on-Click/solution.hide.js: -------------------------------------------------------------------------------- 1 | let button = document.getElementById("superDuperButton"); 2 | button.addEventListener("click", function() { 3 | // Your code here 4 | let newDiv = document.createElement("div"); 5 | newDiv.style.backgroundColor = "yellow"; 6 | newDiv.innerHTML = "Hello World"; 7 | document.body.appendChild(newDiv); 8 | }); 9 | -------------------------------------------------------------------------------- /exercises/05-Create-DOM-Element-First/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CREATE DOM ELEMENT (1st) 7 | 8 | 9 |
    10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /exercises/10-Add-li-on-Click/solution.hide.js: -------------------------------------------------------------------------------- 1 | let button = document.getElementById("superDuperButton"); 2 | button.addEventListener("click", function() { 3 | // Your code here 4 | let newLi = document.createElement("li"); 5 | newLi.innerHTML = "New item"; 6 | let myList = document.getElementById("myList"); 7 | myList.appendChild(newLi); 8 | }); 9 | 10 | -------------------------------------------------------------------------------- /exercises/04-Move-DOM-Element/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | MOVE DOM ELEMENT 7 | 8 | 9 |
    10 | This is the wulu div 11 |
    12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /exercises/09-Render-on-Click/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | RENDER ON CLICK 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /exercises/08.2-Remove-DOM-Element/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | REMOVE DOM ELEMENT (Part 2) 6 | 7 | 8 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /exercises/03-Change-Div-Background/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Change div backgound 8 | 9 | 10 |
    11 | Hello world! 12 |
    13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /exercises/08.1-Remove-DOM-Element/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | REMOVE DOM ELEMENT (Part 1) 7 | 8 | 9 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /exercises/10-Add-li-on-Click/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ADD li ON CLICK 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /exercises/01-hello-world/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

    Hello world title

    10 |

    11 | This is my description, it needs to be long because it is supposed to be a paragraph and not a title. 12 |

    13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /exercises/02-Select-DOM-Element/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | SELECT DOM ELEMENT 7 | 8 | 9 |

    Hello world title

    10 |

    11 | This is my description, it needs to be long because it is supposed to be a 12 | paragraph and not a title. 13 |

    14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /exercises/12-Add-Options-to-the-Select/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ADD OPTIONS TO THE SELECT 8 | 9 | 10 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: 2 | file: .gitpod.dockerfile 3 | 4 | ports: 5 | - port: 3000 6 | onOpen: ignore 7 | 8 | vscode: 9 | extensions: 10 | - learn-pack.learnpack-vscode 11 | 12 | 13 | github: 14 | prebuilds: 15 | # enable for the master/default branch (defaults to true) 16 | master: true 17 | # enable for pull requests coming from this repo (defaults to true) 18 | pullRequests: false 19 | # add a "Review in Gitpod" button as a comment to pull requests (defaults to true) 20 | addComment: false 21 | -------------------------------------------------------------------------------- /exercises/04-Move-DOM-Element/README.md: -------------------------------------------------------------------------------- 1 | # `04` Move DOM Element 2 | 3 | You can change any of the CSS properties whenever you want. CSS has some properties that define the position of an object, which means you can use JavaScript to change the position of an object. 4 | 5 | ## 📝 Instructions: 6 | 7 | 1. In this exercise, the `
    ` with id `#wulu` is floating to the left by default. Using JavaScript, please change the `float` CSS property and make it `float` to the `right`. 8 | 9 | ## 💡 Hint: 10 | 11 | + http://www.w3schools.com/jsref/prop_style_cssfloat.asp 12 | -------------------------------------------------------------------------------- /exercises/12-Add-Options-to-the-Select/solution.hide.js: -------------------------------------------------------------------------------- 1 | let countries = ["USA", "France", "Italy", "Brazil", "Colombia", "Belize", "Venezuela"]; 2 | 3 | // Your code here 4 | let selectElement = document.getElementById("mySelect"); 5 | 6 | for (let i = 0; i < countries.length; i++) { 7 | let option = document.createElement("option"); 8 | option.value = countries[i]; 9 | option.innerHTML = countries[i]; 10 | selectElement.appendChild(option); 11 | } 12 | 13 | selectElement.addEventListener("change", function () { 14 | let selectedCountry = selectElement.value; 15 | alert(selectedCountry); 16 | }); 17 | -------------------------------------------------------------------------------- /exercises/12-Add-Options-to-the-Select/styles.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | body { 3 | text-align: center; 4 | background-size: cover; 5 | } 6 | 7 | select { 8 | -moz-appearance: none; 9 | -webkit-appearance: none; 10 | text-indent: 0.01px; 11 | text-overflow: ""; 12 | padding: 1em 0 1em 1em; 13 | border: 1px solid #107177; 14 | border-radius: 0; 15 | position: relative; 16 | border-right-width: 20px; 17 | background-color: rgba(0, 0, 0, 0.5); 18 | color: #fff; 19 | font-weight: bold; 20 | text-transform: uppercase; 21 | } 22 | select:focus { 23 | outline: none; 24 | border-color: #169ca4; 25 | } 26 | -------------------------------------------------------------------------------- /exercises/10-Add-li-on-Click/README.md: -------------------------------------------------------------------------------- 1 | # `10` Add li on Click 2 | 3 | ## 📝 Instructions: 4 | 5 | 1. Using the `createElement()` function, add a new `
  • ` element to the `#myList` whenever the `#superDuperButton` is clicked. 6 | 7 | ## 💻 Expected result: 8 | 9 | ![Expected result gif](../../.learn/assets/11-1.gif) 10 | 11 | ## 💡 Hints: 12 | 13 | + Get the `#superDuperButton` button with the `getElementById` function. 14 | 15 | + Add a click event listener to the `#superDuperButton`. 16 | 17 | + Inside of that listener function, add the needed code to create the new `
  • ` element and append it to the list as a child. 18 | -------------------------------------------------------------------------------- /exercises/12-Add-Options-to-the-Select/README.md: -------------------------------------------------------------------------------- 1 | # `12` Add Options to the Select 2 | 3 | ## 📝 Instructions: 4 | 5 | 1. Use the `appendChild()` method to add all these countries into the select with the id `#mySelect`. 6 | 7 | 2. Then, add a listener to the `'change'` event and display an alert with the selected country when the user selects it. 8 | 9 | ## 💻 Expected result: 10 | 11 | ![image](../../.learn/assets/13-1.gif) 12 | 13 | ## 💡 Hints: 14 | 15 | + Remember the `for` loop? it can be very handy in this situation. 16 | 17 | + Read about the [change event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event). 18 | -------------------------------------------------------------------------------- /exercises/01-hello-world/README.md: -------------------------------------------------------------------------------- 1 | # `01` Hello World 2 | 3 | The DOM is where all your front-end knowledge combines, you need to know a little bit of HTML, CSS and JavaScript. 4 | 5 | But everything starts with a Hello World, of course 😄 6 | 7 | ## 📝 Instructions: 8 | 9 | 1. This exercise contains one HTML, one CSS and one JS file. Please open your JS file and fill it with the code to prompt an alert saying `Hello World`. 10 | 11 | ## 💡 Hints: 12 | 13 | + Build and preview your exercise code. It will open in a new window. 14 | 15 | + Press the test button when you feel comfortable enough to automatically grade it. Once you are ready, do the next one! 16 | -------------------------------------------------------------------------------- /exercises/04-Move-DOM-Element/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=-klOOsBeBSg" 3 | --- 4 | 5 | 6 | # `04` Move DOM Element 7 | 8 | Puedes cambiar cualquiera de las propiedades CSS cuando lo desees. CSS tiene algunas propiedades que definen la posición de un objeto, esto quiere decir que podemos usar JavaScript para cambiar la posición de un objeto. 9 | 10 | ## 📝 Instrucciones: 11 | 12 | 1. En este ejercicio, el `
    ` con id `#wulu` está flotando (`float`) a la izquierda por defecto. Usando JavaScript, cambia la propiedad CSS `float` y haz que flote a la derecha (`right`). 13 | 14 | ## 💡 Pista: 15 | 16 | + http://www.w3schools.com/jsref/prop_style_cssfloat.asp 17 | -------------------------------------------------------------------------------- /exercises/12-Add-Options-to-the-Select/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=PI1m_7oV8wM" 3 | --- 4 | 5 | 6 | # `12` Add Options to the Select 7 | 8 | ## 📝 Instrucciones: 9 | 10 | 1. Usa el método `appendChild()` para agregar todos estos países al select con el id `#mySelect`. 11 | 12 | 2. Luego, agrega un listener al evento `'change'` y muestra una alerta con el país seleccionado cuando el usuario lo seleccione. 13 | 14 | ## 💻 Resultado esperado: 15 | 16 | ![image](../../.learn/assets/13-1.gif) 17 | 18 | ## 💡 Pistas: 19 | 20 | + ¿Recuerdas el bucle `for`? Puede ser muy útil en esta situación. 21 | 22 | + Lee sobre el [evento change](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event). 23 | -------------------------------------------------------------------------------- /exercises/10-Add-li-on-Click/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=hs0WuLzXWa4" 3 | --- 4 | 5 | 6 | # `10` Add li on Click 7 | 8 | ## 📝 Instrucciones: 9 | 10 | 1. Usando la función `createElement`, agrega un nuevo elemento `
  • ` a `#myList` cada vez que se haga clic en el `#superDuperButton`. 11 | 12 | ## 💻 Resultado Esperado: 13 | 14 | ![Gif del resultado esperado](../../.learn/assets/11-1.gif) 15 | 16 | ## 💡 Pistas: 17 | 18 | + Obtén el botón `#superDuperButton` con la función `getElementById`. 19 | 20 | + Agrega un listener de eventos de *click* al `#superDuperButton`. 21 | 22 | + Dentro de esa función de listener, agrega el código necesario para crear el nuevo elemento `
  • ` y añádelo a la lista como hijo. 23 | -------------------------------------------------------------------------------- /exercises/01-hello-world/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=T3I448FYqWY" 3 | --- 4 | 5 | 6 | # `01` Hello World 7 | 8 | EL DOM es donde se combinan todos tus conocimientos de front-end, debes conocer un poco de HTML, CSS y JavaScript. 9 | 10 | Pero todo comienza con un Hello World, por supuesto. 😄 11 | 12 | ## 📝 Instrucciones: 13 | 14 | 1. Este ejercicio contiene un archivo HTML, un CSS y un archivo JS, abre tu archivo JS y complétalo con el código para generar una alerta con `Hello World`. 15 | 16 | ## 💡 Pistas: 17 | 18 | + Compila y obtén una vista previa del código del ejercicio. Se abrirá en una nueva ventana. 19 | 20 | + Presiona el botón de test cuando te sientas lo suficientemente cómodo para calificarlo automáticamente y pasar al siguiente ejercicio. 21 | -------------------------------------------------------------------------------- /exercises/07-Create-DOM-list-of-li/README.md: -------------------------------------------------------------------------------- 1 | # `07` Create DOM list of li 2 | 3 | A great way to create HTML structures for your website is to concatenate several HTML strings in a single, bigger HTML string and then, append that string to the `innerHTML` of any element that is already a part of the HTML. For example: 4 | 5 | ```js 6 | let htmlString = '
    ' + 'Hello World' + '
    '; 7 | ``` 8 | 9 | ## 📝 Instructions: 10 | 11 | 1. Set the `listString` variable with the value needed to have the following HTML as the `body`'s innerHTML: 12 | 13 | ```html 14 | 19 | ``` 20 | 21 | ## 💡 Hint: 22 | 23 | + Remember that the white spaces and indentation are ignored by the browser's interpreter. 24 | -------------------------------------------------------------------------------- /exercises/00-Welcome/README.md: -------------------------------------------------------------------------------- 1 | # `00` Welcome to The DOM 😆 !! 2 | 3 | Being a front-end web developer it's all about [The DOM](https://4geeks.com/lesson/what-is-dom-define-dom). After this tutorial, you'll understand the following concepts: 4 | 5 | + Manipulating website styles from JavaScript. 6 | 7 | + Manipulating website HTML from JavaScript. 8 | 9 | + Updating the website without refreshing. 10 | 11 | + Selecting elements from The DOM using `document.querySelector` and updating their code using `innerHTML`. 12 | 13 | + Event oriented programming: listening to user and system events. 14 | 15 | + Programmatically creating website elements and tags using `createNode()`. 16 | 17 | + Practicing user oriented events like: `onClick`, `onMouseHover`, etc. 18 | 19 | + Event Listeners and Events Handlers. 20 | -------------------------------------------------------------------------------- /exercises/06-Create-DOM-Element-Second/README.md: -------------------------------------------------------------------------------- 1 | # `06` Create DOM Element (2) 2 | 3 | In the last exercise, we saw how to create an HTML DOM element using the `createElement()` and `appendChild()` functions. There is another way to add an element to the HTML of the website: `innerHTML`. 4 | 5 | The `innerHTML` property is used to SET the HMTL content inside of any current DOM element. For example, if we want to add a new `

    ` element to the website `` we can do: 6 | 7 | ```js 8 | document.body.innerHTML = "

    Hello World

    "; 9 | ``` 10 | 11 | ## 📝 Instructions: 12 | 13 | 1. Insert an image with the source "https://via.placeholder.com/350x150" into the ``. 14 | 15 | ## 💡 Hint: 16 | 17 | + Here is the documentation for the `innerHTML` property: http://www.w3schools.com/jsref/prop_html_innerhtml.asp 18 | -------------------------------------------------------------------------------- /exercises/13-Todo-List/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | TODO LIST 9 | 10 | 11 |
    12 |

    To do List

    13 | 14 | 25 |
    26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /exercises/08.1-Remove-DOM-Element/README.md: -------------------------------------------------------------------------------- 1 | # `08.1` Remove DOM Element 2 | 3 | If you want to remove an element from the DOM, you use the `removeChild()` function. The challenge behind this function is that it needs to be called from the parent of the element that you want to remove. For example: 4 | 5 | ```html 6 | 11 | ``` 12 | 13 | In the previous code, to remove the second element, we need the function `removeChild()` from the parent `