Closed MaximilianPi closed 3 years ago
I think it's the path to the questionnaire. Put it in explicitly or maybe we use an uploaded version of that and refer to it.
No, the path (you mean the path to the saved script, right? ('script.js')) is correct because it is checked during compilation which will be aborted with a wrong path... so I assume that the script is correctly loaded and the makeMultipleChoiceForm function is called but nothing shows up.
Well, I saw 2 errors. You have to specify the right path (the name of the script is "multipleChoice" though). And you have to use 2 script tags. One to include the script and one for writing your own content.
Here is a (at least for me) working example:
<script src="./scripts/multipleChoice.js"></script>
<script>
makeMultipleChoiceForm(
'How much is the fish?',
'text',
[
{
'answer':'123',
'correct':true,
'explanationIfSelected':'Right guess.',
'explanationIfNotSelected':'Wrong guess.',
'explanationGeneral':''
},
{
'answer':'321',
'correct':false,
'explanationIfSelected':'Wrong guess.',
'explanationIfNotSelected':'',
'explanationGeneral':''
}
],
'comment text'
);
</script>
ah perfect! It is working with two script tags, thanks!
Hi @Meier-Matthias,
the code for the questionnaire looks very nice (and well documented) but I don't know how to get it work within a bookdown:
I embedded the questionnaire as a html chunk in a Rmarkdown but the questionnaire doesn't show up in the compiled book.
PS: there is a minimal bookdown example (https://github.com/yihui/bookdown-minimal) for testing.