iswhoa/scripts/controllers/picker.js
Leon Mika 37d70eed8f Initial commit
Have got a question working
2025-06-18 13:49:42 +02:00

25 lines
552 B
JavaScript

import { Controller } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js";
export default class extends Controller {
static targets = [ "radio" ];
static values = {
answer: String
};
connect() {
}
submitAnswer(ev) {
ev.preventDefault();
this.radioTargets.forEach(e => {
e.disabled = true;
if (e.value === this.answerValue) {
e.classList.add("answer");
} else {
e.classList.add("wrong");
}
});
}
};