所以我有一個JavaScript數組,數組中我有這樣的:在陣列的解釋子打印的Javascript數組值正確
var quiz = [{
"question": "What is the greatest common factor of 105 and 126?",
"image": "",
"choices": ["3", "7",
"9", "21", "35"
],
"correct": "21",
"conceptlink": "https://www.khanacademy.org/math/in-sixth-grade-math/playing-numbers/highest-common-factor/v/greatest-common-divisor",
"explanation": "In order to solve this question, you must factor each number into prime factors<h1>Height</h1>",
}];
焦點。我有一個我想打印的H1元素,但是,它被打印爲文本的一部分而不是代碼。換句話說,文本內容如下:
下面是打印解釋從JS專家將很樂意
$('#explanation').html('<strong>Incorrect.</strong> ' + htmlEncode(quiz[currentquestion]['explanation']));
任何幫助代碼感謝!
'htmlEncode()'似乎工作正常:) – Andreas
不幸的是。我多次測試過它。 :( –