My array is not loading pictures to the html [on hold]


New Member
I believe I have this coded correctly, but I'm not getting the image to show up.

Here is the array of questions, answers and the image:
var questions = [

question:"Where should choking victims place their hands to indicate to others that they need help?",

choices:["A: Over the eyes", "B: Around the throat", "C: On the knees", "D: On the hips"],
correctAnswer:"B: Around the throat",

image:"<img: src='../assets/images/jeopardy.png' class='cashMoney'>"]
Here is how I'm calling the image:
function playerWin() {
    var image = questions[questionTracker].image;
    $("#gameShow").html("<p>You got it right!</p>");
I also tried appending the image to a Div through its own function
function displayImage() {
    var image = questions[questionTracker].image;
The image should show up with the
tag, but it does not.
Very new to all this. Any help greatly appreciated! Sorry If I didn't format the question correctly. It looks fine on the editor but loses the indentation when I post. :/


Thành viên BQT
Your image isn't working because of the invalid HTML:
<img src: '...'>
There shouldn't be a colon. Replace this line in your array:
image:"<img: src='../assets/images/jeopardy.png' class='cashMoney'>"]
With this line:
image:"<img src='../assets/images/jeopardy.png' class='cashMoney'>"];
And your problem will be fixed.

Từ khóa phổ biến

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.