Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Option values aren't added each time, anymore.
  • Loading branch information
haha1906 committed Sep 28, 2019
commit 5fcd491b04dc92d5e434daa569b98b032e8ee16d
10 changes: 9 additions & 1 deletion homework/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
}

function deleteContainers() {
const selectButton = document.getElementById('selectButton');
let firstOption = selectButton.firstChild;
while (firstOption) {
selectButton.removeChild(firstOption);
firstOption = selectButton.firstChild;
}
document.getElementById('flex-container').remove();
}

Expand Down Expand Up @@ -134,7 +140,9 @@
const promise = fetchJSON(url);
promise
.then(repos => {
const selectButton = createAndAppend('select', header);
const selectButton = createAndAppend('select', header, {
id: 'selectButton',
});
selectButton.addEventListener('change', () => {
deleteContainers();
makeFlexContainer(root, repos, selectButton);
Expand Down