Skip to content

Commit 097165c

Browse files
committed
Fix: Ensured quiz start window is cleared if quiz was deleted
1 parent 6b8818d commit 097165c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/js/main.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,14 @@ function deleteQuiz(name) {
106106
localStorage.removeItem(name);
107107
fetchQuizList();
108108
}
109+
if ( name == $("#quiz-name").text() ) {
110+
$("#quiz-window").empty();
111+
}
109112
}
110113

111114
function startQuiz(name) {
112115
let startScreen = `
113-
<h2>${name}</h2>
116+
<h2 id="quiz-name">${name}</h2>
114117
<button class = "btn" id = "begin-btn">Begin</button>
115118
`;
116119
$("#quiz-window").html(startScreen);

0 commit comments

Comments
 (0)