【发布时间】:2021-06-18 07:32:27
【问题描述】:
我的 JSON 文件包含一个 Mathjax 公式:
Mathjax 公式显示不正确,它在编写时显示。当我将该公式直接放入 HTML 时,它可以正常工作,并按应有的方式显示公式。我该怎么办?提前致谢。
const currentQuestion = {
"question": "\\[x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.\\]",
"choice1": "kw",
"choice2": "k22",
"choice3": "k3",
"answer": 3
}
const choices = document.querySelectorAll(".choice-text");
choices.forEach((choice) => {
const number = choice.dataset['number'];
choice.innerHTML = currentQuestion['choice' + number];
});
<h2 id="question">Koji je odgovor na sledeca pitanja</h2>
<div class="choice-container">
<p class="choice-prefix">A</p>
<p class="choice-text" data-number="1">Choice 1</p>
</div>
<div class="choice-container">
<p class="choice-prefix">B</p>
<p class="choice-text" data-number="2">Choice 2</p>
</div>
<div class="choice-container">
<p class="choice-prefix">C</p>
<p class="choice-text" data-number="3">Choice 3</p>
</div>
【问题讨论】:
-
我给你做了一个sn-p。请添加相关的 HTML 和其他代码。例如,您在哪里设置问题?
-
好的,谢谢,我会添加整个代码。
-
查看我的更新答案。您需要正确的文件
标签: javascript html json mathjax