Skip to content

Commit 1aa4473

Browse files
committed
Rename loadTapas -> listToHTML & add parameters
1 parent 388a06d commit 1aa4473

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

15 - LocalStorage/my-index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ <h2>LOCAL TAPAS</h2>
3232

3333
}
3434

35-
function loadTapas() {
36-
const html = items.map((item, index) => {
35+
function listToHTML(list = [], parentElement) {
36+
const html = list.map((item, index) => {
3737
const checked = (item.done ? "checked" : "");
3838
return `<li>
39-
<input type="checkbox" data-index=${index} value=${item.done} ${checked}>
40-
<label>${item.text}</label>
39+
<input type="checkbox" data-index=${index} id="item${index}" ${checked}>
40+
<label for="item${index}">${item.text}</label>
4141
</li>`;
4242
}).join('')
43-
itemsList.innerHTML = html;
43+
parentElement.innerHTML = html;
4444
}
4545

4646
document.addEventListener('DOMContentLoaded', loadTapas);

0 commit comments

Comments
 (0)