iswhoa/scripts/controllers/picker.js

25 lines
552 B
JavaScript
Raw Normal View History

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");
}
});
}
};