- Task 1: Select an HTML element by its ID and change its text content.
- Task 2: Select an HTML element by its class and change its background color.
- Task 3: Create a new
div
with text and append it to the body. - Task 4: Create a new
li
element and add it to an existingul
.
- Task 5: Remove an HTML element from the DOM.
- Task 6: Remove the last child of a specific HTML element.
- Task 7: Change an attribute (e.g.,
src
of animg
). - Task 8: Add and remove a CSS class to/from an element.
- Task 9: Add a click event listener to a button to change paragraph text.
- Task 10: Add a mouseover event listener to change an element's border color.
- Text Content Manipulation Script: Change text content by ID.
- Element Creation Script: Create and append a
div
. - Element Removal Script: Remove an element from the DOM.
- Attribute Modification Script: Change HTML element attributes.
- Event Handling Script: Add event listeners to change content or style.
By the end of these activities, students will:
- Select and manipulate DOM elements using JavaScript.
- Create and append new elements to the DOM.
- Remove elements from the DOM.
- Modify attributes and classes of HTML elements.
- Add and handle events for interactive web pages.