|
| 1 | +# Day 9: DOM Manipulation 🎨 |
| 2 | + |
| 3 | +Welcome to Day 9 of our JavaScript workshop! Today, we will explore the Document Object Model (DOM) and learn how to interact with HTML elements using JavaScript. 🌟 |
| 4 | + |
| 5 | +## Learning Objectives 📚 |
| 6 | + |
| 7 | +By the end of these activities, you will: |
| 8 | +- Select and manipulate DOM elements using JavaScript. |
| 9 | +- Create and append new elements to the DOM. |
| 10 | +- Remove elements from the DOM. |
| 11 | +- Modify attributes and classes of HTML elements. |
| 12 | +- Add and handle events to make web pages interactive. |
| 13 | + |
| 14 | +## Activities 🛠️ |
| 15 | + |
| 16 | +This workshop is divided into several activities: |
| 17 | + |
| 18 | +### Activity 1: Selecting and Manipulating Elements 🖱️ |
| 19 | + |
| 20 | +- [ ] **Task 1:** Select an HTML element by its ID and change its text content. |
| 21 | +- [ ] **Task 2:** Select an HTML element by its class and change its background color. |
| 22 | + |
| 23 | +### Activity 2: Creating and Appending Elements 🏗️ |
| 24 | + |
| 25 | +- [ ] **Task 3:** Create a new `div` element with some text content and append it to the body. |
| 26 | +- [ ] **Task 4:** Create a new `li` element and add it to an existing `ul` list. |
| 27 | + |
| 28 | +### Activity 3: Removing Elements ❌ |
| 29 | + |
| 30 | +- [ ] **Task 5:** Select an HTML element and remove it from the DOM. |
| 31 | +- [ ] **Task 6:** Remove the last child of a specific HTML element. |
| 32 | + |
| 33 | +### Activity 4: Modifying Attributes and Classes 🔄 |
| 34 | + |
| 35 | +- [ ] **Task 7:** Select an HTML element and change one of its attributes (e.g., `src` of an `img` tag). |
| 36 | +- [ ] **Task 8:** Add and remove a CSS class to/from an HTML element. |
| 37 | + |
| 38 | +### Activity 5: Event Handling 🎯 |
| 39 | + |
| 40 | +- [ ] **Task 9:** Add a click event listener to a button that changes the text content of a paragraph. |
| 41 | +- [ ] **Task 10:** Add a mouseover event listener to an element that changes its border color. |
| 42 | + |
| 43 | +## Feature Requests (Optional) 🎨 |
| 44 | + |
| 45 | +1. **Text Content Manipulation Script:** Write a script that selects an HTML element by its ID and changes its text content. |
| 46 | +2. **Element Creation Script:** Create a script that demonstrates creating a new `div` element and appending it to the body. |
| 47 | +3. **Element Removal Script:** Write a script that selects an HTML element and removes it from the DOM. |
| 48 | +4. **Attribute Modification Script:** Create a script that changes the attributes of an HTML element. |
| 49 | +5. **Event Handling Script:** Write a script that adds event listeners to HTML elements to change their content or style based on user interactions. |
| 50 | + |
| 51 | +Happy coding! 💻✨ |
0 commit comments