We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 388a06d commit 1aa4473Copy full SHA for 1aa4473
15 - LocalStorage/my-index.html
@@ -32,15 +32,15 @@ <h2>LOCAL TAPAS</h2>
32
33
}
34
35
- function loadTapas() {
36
- const html = items.map((item, index) => {
+ function listToHTML(list = [], parentElement) {
+ const html = list.map((item, index) => {
37
const checked = (item.done ? "checked" : "");
38
return `<li>
39
- <input type="checkbox" data-index=${index} value=${item.done} ${checked}>
40
- <label>${item.text}</label>
+ <input type="checkbox" data-index=${index} id="item${index}" ${checked}>
+ <label for="item${index}">${item.text}</label>
41
</li>`;
42
}).join('')
43
- itemsList.innerHTML = html;
+ parentElement.innerHTML = html;
44
45
46
document.addEventListener('DOMContentLoaded', loadTapas);
0 commit comments