Skip to content

Commit 3da4036

Browse files
authored
Check Answer button ergonomics (#90)
1 parent 8acc247 commit 3da4036

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/templates/exercise.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ <h5 id="{{ qindex }}question_text" class="card-title mb-2">
150150

151151

152152

153-
<button class="btn btn-primary" onclick="{{q.type}}_getfeedback(this); enableNextButton(this); scrollToFeedback()">Check
153+
<button class="btn btn-primary checkanswer" onclick="{{q.type}}_getfeedback(this); enableNextButton(this); scrollToFeedback()" disabled>Check
154154
Answer</button>
155155
<!-- TODO: Disable this, and then re-enable -->
156156
<button class="btn btn-primary next" disabled>Next Question</button>
@@ -258,6 +258,18 @@ <h4 class="card-title">What Next?</h4>
258258
$('#done').show();
259259
}
260260
});
261+
262+
// Disable all "Check Answer" buttons initially
263+
$('.checkanswer').prop('disabled', true);
264+
265+
// Add event listeners to radio buttons
266+
$('input[type="radio"]').on('change', function () {
267+
// Find the parent question card
268+
const questionCard = $(this).closest('.question');
269+
270+
// Enable the "Check Answer" button within the same question card
271+
questionCard.find('.checkanswer').prop('disabled', false);
272+
});
261273
});
262274
</script>
263275

0 commit comments

Comments
 (0)