Added button to show the correct answers
This commit is contained in:
parent
c6a8af1a06
commit
510cec2d9a
@ -8,7 +8,6 @@
|
|||||||
const forms = document.querySelectorAll('form');
|
const forms = document.querySelectorAll('form');
|
||||||
const form = forms[0];
|
const form = forms[0];
|
||||||
|
|
||||||
console.log('dupa');
|
|
||||||
Array.from(form.elements).forEach((input) => {
|
Array.from(form.elements).forEach((input) => {
|
||||||
if (input.type=="text") {
|
if (input.type=="text") {
|
||||||
console.log(input.dataset.expected.length)
|
console.log(input.dataset.expected.length)
|
||||||
@ -54,6 +53,17 @@
|
|||||||
|
|
||||||
return false;
|
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>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -62,7 +72,7 @@
|
|||||||
<form class="Pensum_A" onsubmit="return validate();">
|
<form class="Pensum_A" onsubmit="return validate();">
|
||||||
{{pensum_content|safe}}
|
{{pensum_content|safe}}
|
||||||
<br>
|
<br>
|
||||||
<input type="submit" value="Mitte">
|
<input type="submit" value="Mitte"><button onclick="show_answers()">Responsa</button>
|
||||||
</form>
|
</form>
|
||||||
<script type="text/javascript">adjust_size();</script>
|
<script type="text/javascript">adjust_size();</script>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user