|
1 | | -# 🔧 JavaScript DOM Tasks – Beginner Practice |
| 1 | +# 📘 JavaScript DOM Practice Tasks |
2 | 2 |
|
3 | | -This repository contains beginner-friendly JavaScript DOM manipulation tasks. Each task focuses on a small concept to build a strong foundation in working with the DOM using vanilla JavaScript. |
4 | | - |
5 | | -> 📌 Currently contains **9 tasks**. More will be added regularly. Final target: **20+ mini DOM projects**. |
6 | | -
|
7 | | ---- |
8 | | - |
9 | | -## ✅ Completed Tasks |
10 | | - |
11 | | -| No. | Task Name | Description | Live Demo | |
12 | | -|-----|-----------------------------|----------------------------------------------------------------------------|------------------------| |
13 | | -| 1 | Change and Revert Heading | Changes the heading text on button click, and reverts on second click. | [Click to view Live](https://suru190.github.io/JavaScript-Dom-Practice/task01-change-and-revert-heading)| |
14 | | -| 2 | Toggle Button Text | Toggles the text of a single button between two values. | [Click to view Live](https://suru190.github.io/JavaScript-Dom-Practice/task02-toggle-button-text)| |
15 | | -| 3 | Multiple Headings | Changes the text of multiple headings using loop and `querySelectorAll`. | [Click to view Live](https://suru190.github.io/JavaScript-Dom-Practice/task03-multiple-heading)| |
16 | | -| 4 | innerHTML vs textContent | Shows the difference between `.textContent` and `.innerHTML` when used. | [Click to view Live](https://suru190.github.io/JavaScript-Dom-Practice/task04-innerHTML-vs-textContent)| |
17 | | -| 5 | Change Style on Click | Changes the background and text color of a heading element on click. | [Click to view Live](https://suru190.github.io/JavaScript-Dom-Practice/task05-change-style-on-click)| |
18 | | -| 6 | Update Heading | User types in the input and replaces the default heading with user-entered text on button click. | [Click to view Live](https://suru190.github.io/JavaScript-Dom-Practice/task06-update-heading)| |
19 | | -| 7 | Show / Hide Paragraph | Click the button to show or hide a paragraph. | [Click to view Live](https://suru190.github.io/JavaScript-Dom-Practice/task07-show-hide-paragraph)| |
20 | | -| 8 | Live Character Counter | Displays character count live as you type in the input field. | [Click to view Live](https://suru190.github.io/JavaScript-Dom-Practice/task08-live-character-counter)| |
21 | | -| 9 | Increase Couter on Every Button Click | A button click increases the counter value and updates it on screen. | [Click to view Live](https://suru190.github.io/JavaScript-Dom-Practice/task09-increase-counter-on-every-button-click)| |
22 | | - |
23 | | ---- |
24 | | - |
25 | | -## ✅ Tasks Completed So Far |
26 | | - |
27 | | -### 1️⃣ Change and Revert Heading |
28 | | -- Click the button to change the heading text. |
29 | | -- Click again to revert it to the original text. |
30 | | -- ✅ Concepts used: |
31 | | - - `textContent` |
32 | | - - `addEventListener` |
33 | | - - DOM element selection |
34 | | - - If/else condition |
35 | | - |
36 | | ---- |
37 | | - |
38 | | -### 2️⃣ Toggle Button Text |
39 | | -- A button that toggles its label between two states (e.g., "Start" ↔ "Stop!"). |
40 | | -- ✅ Concepts used: |
41 | | - - Button interaction |
42 | | - - Event handling |
| 3 | +This repository contains beginner-friendly JavaScript DOM manipulation tasks. Each task is focused on practicing core DOM concepts with clean structure and interactive behavior. |
43 | 4 |
|
44 | 5 | --- |
45 | 6 |
|
46 | | -### 3️⃣ Multiple Headings Change |
47 | | -- Change the text of multiple `<h1>` elements with a single button click. |
48 | | -- ✅ Concepts used: |
49 | | - - `querySelectorAll` |
50 | | - - `forEach()` loop |
51 | | - - DOM manipulation for multiple elements |
52 | | - |
53 | | ---- |
| 7 | +## ✅ Completed Tasks Structure |
54 | 8 |
|
55 | | -### 4️⃣ innerHTML vs textContent |
56 | | -- Demonstrates the difference between `.innerHTML` and `.textContent`. |
57 | | -- Shows how `.textContent` treats HTML tags as plain text, while `.innerHTML` renders them as HTML. |
58 | | -- ✅ Concepts used: |
59 | | - - `textContent` |
60 | | - - `innerHTML` |
61 | | - - DOM manipulation |
62 | | - - Button events |
| 9 | +Each task contains: |
| 10 | +- `index.html` – HTML Structure |
| 11 | +- `style.css` – Styling |
| 12 | +- `script.js` – JavaScript functionality |
| 13 | +- `README.md` – Task description, concepts used, what I learned, and flow |
63 | 14 |
|
64 | 15 | --- |
65 | 16 |
|
66 | | -### 5️⃣ Change Style on Click |
67 | | -- Clicking the button changes the color and background of a heading. |
68 | | -- Useful for practicing dynamic style changes using JavaScript. |
69 | | -- ✅ Concepts used: |
70 | | - - `style` property |
71 | | - - `addEventListener` |
72 | | - - DOM element selection |
| 17 | +## 📂 Tasks List |
73 | 18 |
|
74 | | ---- |
75 | | - |
76 | | -### 6️⃣ Update Heading |
77 | | -- Updates both the heading text and button text when the button is clicked. |
78 | | -- Demonstrates how to change multiple elements dynamically. |
79 | | -- ✅ Concepts used: |
80 | | - - `textContent` |
81 | | - - `addEventListener` |
82 | | - - DOM manipulation |
83 | | - - Updating multiple elements |
| 19 | +| No. | Task Name | Live Demo | Code | |
| 20 | +|-----|-----------|-----------|------| |
| 21 | +| 01 | Change and Revert Heading | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task01-change-and-revert-heading/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task01-change-and-revert-heading) | |
| 22 | +| 02 | Toggle Button Text | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task02-toggle-button-text/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task02-toggle-button-text) | |
| 23 | +| 03 | Multiple Heading | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task03-multiple-heading/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task03-multiple-heading) | |
| 24 | +| 04 | innerHTML vs textContent | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task04-innerHTML-vs-textContent/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task04-innerHTML-vs-textContent) | |
| 25 | +| 05 | Change Style on Click | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task05-change-style-on-click/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task05-change-style-on-click) | |
| 26 | +| 06 | Update Heading | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task06-update-heading/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task06-update-heading) | |
| 27 | +| 07 | Show / Hide Paragraph | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task07-show-hide-paragraph/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task07-show-hide-paragraph) | |
| 28 | +| 08 | Live Character Counter | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task08-live-character-counter/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task08-live-character-counter) | |
| 29 | +| 09 | Increase Counter on Every Button Click | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task09-increase-counter-on-every-button-click/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task09-increase-counter-on-every-button-click) | |
| 30 | +| 10 | Add List Items Dynamically | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task10-add-list-items-dynamically/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task10-add-list-items-dynamically) | |
| 31 | +| 11 | Delete List Items Dynamically | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task11-delete-list-items-dynamically/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task11-delete-list-items-dynamically) | |
| 32 | +| 12 | Mark List as Completed | 🔗 [Live Demo](https://suru190.github.io/JavaScript-Dom-practice/task12-mark-list-as-completed/) | 💻 [Code](https://github.com/suru190/JavaScript-Dom-practice/tree/main/task12-mark-list-as-completed) | |
84 | 33 |
|
85 | 34 | --- |
86 | 35 |
|
87 | | -### 7️⃣ Show / Hide Paragraph |
88 | | -- Click the button to toggle visibility of a paragraph. |
89 | | -- ✅ Concepts used: |
90 | | - - `style.display` |
91 | | - - Toggle logic with `if` condition |
92 | | - - DOM element selection |
| 36 | +## 📌 Purpose |
93 | 37 |
|
94 | | ---- |
| 38 | +This repository helps in understanding: |
| 39 | +- DOM selection and manipulation |
| 40 | +- Event handling |
| 41 | +- Conditional rendering |
| 42 | +- Styling and interaction using JavaScript |
95 | 43 |
|
96 | | -### 8️⃣ Live Character Counter |
97 | | -- As you type in the input, character count updates live. |
98 | | -- ✅ Concepts used: |
99 | | - - `input` event |
100 | | - - `textContent` |
101 | | - - DOM events and real-time update |
102 | | - |
103 | 44 | --- |
104 | | - |
105 | | -### 9️⃣ Increase Counter on Every Button Click |
106 | | -- Click the button to increase the counter by 1 on every click. |
107 | | -- Counter starts from **0** and updates live on screen. |
108 | | -- ✅ **Concepts used**: |
109 | | - - `textContent` |
110 | | - - `addEventListener` |
111 | | - - DOM element selection |
112 | | - - Variables and Increment (`++`) |
113 | | - - Updating DOM in real-time |
114 | | - |
115 | | ---- |
116 | | - |
117 | | -## 📁 Project Structure |
118 | | - |
119 | | -``` |
120 | | -JavaScript-Dom-Practice/ |
121 | | -│ |
122 | | -├── Task-01/ (Change and Revert Heading) |
123 | | -│ ├── index.html |
124 | | -│ ├── style.css |
125 | | -│ └── script.js |
126 | | -│ |
127 | | -├── Task-02/ (Toggle Button Text) |
128 | | -│ ├── index.html |
129 | | -│ ├── style.css |
130 | | -│ └── script.js |
131 | | -│ |
132 | | -├── Task-03/ (Multiple Headings) |
133 | | -│ ├── index.html |
134 | | -│ ├── style.css |
135 | | -│ └── script.js |
136 | | -│ |
137 | | -├── Task-04/ (innerHTML vs textContent) |
138 | | -│ ├── index.html |
139 | | -│ ├── style.css |
140 | | -│ └── script.js |
141 | | -│ |
142 | | -├── Task-05/ (Change Style on Click) |
143 | | -│ ├── index.html |
144 | | -│ ├── style.css |
145 | | -│ └── script.js |
146 | | -│ |
147 | | -├── Task-06/ (Update Heading) |
148 | | -│ ├── index.html |
149 | | -│ ├── style.css |
150 | | -│ └── script.js |
151 | | -│ |
152 | | -├── Task-07/ (Show / Hide Paragraph) |
153 | | -│ ├── index.html |
154 | | -│ ├── style.css |
155 | | -│ └── script.js |
156 | | -│ |
157 | | -├── Task-08/ (Live Character Counter) |
158 | | -│ ├── index.html |
159 | | -│ ├── style.css |
160 | | -│ └── script.js |
161 | | -│ |
162 | | -├── Task-09/ (Increase Counter on Every Button Click) |
163 | | -│ ├── index.html |
164 | | -│ ├── style.css |
165 | | -│ └── script.js |
166 | | -| |
167 | | -└── README.md |
168 | | -``` |
0 commit comments