From 510cec2d9a200c9f17a9496cba2268ff62f9e4d1 Mon Sep 17 00:00:00 2001 From: Sergiusz Warga Date: Wed, 25 Nov 2020 22:06:46 +0100 Subject: [PATCH] Added button to show the correct answers --- app/templates/LLPSI/Pensum_cloze.html | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/templates/LLPSI/Pensum_cloze.html b/app/templates/LLPSI/Pensum_cloze.html index 81f1d97..6c03082 100644 --- a/app/templates/LLPSI/Pensum_cloze.html +++ b/app/templates/LLPSI/Pensum_cloze.html @@ -7,8 +7,7 @@ function adjust_size() { const forms = document.querySelectorAll('form'); const form = forms[0]; - - console.log('dupa'); + Array.from(form.elements).forEach((input) => { if (input.type=="text") { console.log(input.dataset.expected.length) @@ -54,6 +53,17 @@ return false; } + + function show_answers() { + const forms = document.querySelectorAll('form'); + const form = forms[0]; + + Array.from(form.elements).forEach((input) => { + if (input.type=="text") { + input.setAttribute("value", input.dataset.expected); + } + }); + } @@ -62,7 +72,7 @@
{{pensum_content|safe}}
- +