Challenge: Add and Remove DOM Elements
Task
You're building a shopping cart where users can add and remove items.
- Add an Item to the Cart:
- Create a new
<li>
element; - Create a new
<button>
element; - Add new
<button>
element to the new<li>
element; - Add a new
<li>
element to the<ul>
with thecart-list
ID.
- Create a new
- Remove an Item from the Cart: Delete the specific
<li>
element from the<ul>
.
index.html
index.css
index.js
- Use
createElement
to create a new<li>
element; - Use
createElement
to create a new<button>
element; - Use
appendChild
to add new<button>
element to the<li>
element; - Use
appendChild
to add a new<li>
element to the<ul>
with the IDcart-list
; - Use
removeChild
to delete the specific<li>
element from the<ul>
.
index.html
index.css
index.js
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 11
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 2.22
Challenge: Add and Remove DOM Elements
Свайпніть щоб показати меню
Task
You're building a shopping cart where users can add and remove items.
- Add an Item to the Cart:
- Create a new
<li>
element; - Create a new
<button>
element; - Add new
<button>
element to the new<li>
element; - Add a new
<li>
element to the<ul>
with thecart-list
ID.
- Create a new
- Remove an Item from the Cart: Delete the specific
<li>
element from the<ul>
.
index.html
index.css
index.js
- Use
createElement
to create a new<li>
element; - Use
createElement
to create a new<button>
element; - Use
appendChild
to add new<button>
element to the<li>
element; - Use
appendChild
to add a new<li>
element to the<ul>
with the IDcart-list
; - Use
removeChild
to delete the specific<li>
element from the<ul>
.
index.html
index.css
index.js
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 11