Files
mqtt-5-learning/teaching/assets/quiz.js
T
Ryan fb30e8e884 Refactor MQTT course and bound backend message processing
Move lesson source into the teaching structure, align the course path with the learner's Go and DevOps experience, and add the interactive lesson guides. Add advanced DevOps lifecycle study as a separate section.

Bound MQTT message work and drain accepted jobs during shutdown; align the backend implementation with the revised course through Section 6.
2026-10-22 10:19:56 +03:30

18 lines
749 B
JavaScript

document.querySelectorAll("form[data-quiz]").forEach((form) => {
form.addEventListener("submit", (event) => {
event.preventDefault();
const selected = form.querySelector('input[type="radio"]:checked');
const feedback = form.querySelector("[data-feedback]");
if (!selected) {
feedback.textContent = "Choose an answer first, then check your reasoning.";
feedback.dataset.state = "incorrect";
return;
}
const correct = selected.value === form.dataset.correct;
feedback.textContent = correct
? form.dataset.explanation
: form.dataset.retry || "Not quite. Trace which component produced this evidence, then try again.";
feedback.dataset.state = correct ? "correct" : "incorrect";
});
});