Added button to show the correct answers

This commit is contained in:
Sergiusz Warga 2020-11-25 22:06:46 +01:00
parent c6a8af1a06
commit 510cec2d9a

View File

@ -8,7 +8,6 @@
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);
}
});
}
</script>
</head>
<body>
@ -62,7 +72,7 @@
<form class="Pensum_A" onsubmit="return validate();">
{{pensum_content|safe}}
<br>
<input type="submit" value="Mitte">
<input type="submit" value="Mitte"><button onclick="show_answers()">Responsa</button>
</form>
<script type="text/javascript">adjust_size();</script>
</body>