The simple quiz does not work as written. I found the following issues:
Step 2
The virtual keyboard doesn't load. Firefox says Uncaught TypeError: window.mathVirtualKeyboard is null. Edge says Uncaught TypeError: Cannot read properties of null (reading 'addEventListener'). I was able to fix this by loading MathLive as a module. I'm not sure what the intended fix for this is.
Step 3
mathfield is not defined. Fixed by adding const mathfield = document.getElementById('answer'); Combining the issues from Steps 2 and 3, the code looks like this:
Step 6
In the first part, the div should have id "question". Additionally, since I am using the module due to the issue in Step 2, I needed to directly import the required functions:
import { renderMathInElement, convertLatexToMarkup } from "https://unpkg.com/mathlive?module";
but I suspect that a different fix to the issue in Step 2 wouldn't require this.
In the second part of Step 6, the code tries to set the htmlContent property of the span tag, which doesn't do anything. I think innerHTML was meant here.
Step 7
Again, I think innerHTML was meant instead of htmlContent.
For the life of me, I cannot get ce.add or ce.mul to work (or at least it did not work in Firefox or Edge, where it kept saying Uncaught TypeError: e.every is not a function). I don't understand what the inputs to ce.add and ce.mul are supposed to be. Instead, I just replaced it with
The simple quiz does not work as written. I found the following issues:
Step 2 The virtual keyboard doesn't load. Firefox says
Uncaught TypeError: window.mathVirtualKeyboard is null
. Edge saysUncaught TypeError: Cannot read properties of null (reading 'addEventListener')
. I was able to fix this by loading MathLive as a module. I'm not sure what the intended fix for this is.Step 3 mathfield is not defined. Fixed by adding
const mathfield = document.getElementById('answer');
Combining the issues from Steps 2 and 3, the code looks like this:Step 4 Again, mathfield is undefined.
Step 6 In the first part, the div should have id "question". Additionally, since I am using the module due to the issue in Step 2, I needed to directly import the required functions:
but I suspect that a different fix to the issue in Step 2 wouldn't require this.
In the second part of Step 6, the code tries to set the
htmlContent
property of thespan
tag, which doesn't do anything. I thinkinnerHTML
was meant here.Step 7 Again, I think
innerHTML
was meant instead ofhtmlContent
.For the life of me, I cannot get ce.add or ce.mul to work (or at least it did not work in Firefox or Edge, where it kept saying
Uncaught TypeError: e.every is not a function
). I don't understand what the inputs to ce.add and ce.mul are supposed to be. Instead, I just replaced it withand then everything worked fine.