0

I'm running a quiz using SlickQuiz, I'm amending the .js file and instead of showing the question through text I want to call an image in. here is the code:

{
    "q": "This is the question area where I'd prefer to call an image?",
    "a": [
        {"option": "Answer 1",    "correct": false},
        {"option": "Answer 2",     "correct": true},
        {"option": "Answer 3",      "correct": false}// no comma here
    ],
    "correct": "<p><span>Well done!</span> The correct answer is Answer 2.</p>",
    "incorrect": "<p><span>Incorrect</span> The correct answer is Answer 2.</p>" // no comma here
}

So the "q" line is where I want to call an image in. Anyone got any ideas? Thanks

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
mickmaster
  • 15
  • 5
  • 1
    Yeah, that's the easiest thing to try - just throw an `` in there and see if it works. If not, you'll have to either edit the plugin or change the HTML after it's generated by SlickQuiz, neither of which is particularly elegant. – jfmatt Nov 08 '12 at 15:28
  • why don't you just use tag, set the href and when you insert it into the html, the image is loaded.... – Stefan Nov 08 '12 at 15:28
  • Sorry folks, should have mentioned, I had tried a tag, this kills all the coding. – mickmaster Nov 08 '12 at 15:38
  • q is a html string, it populates a
    . You can see the original files here: https://github.com/jewlofthelotus/SlickQuiz
    – mickmaster Nov 08 '12 at 15:40

2 Answers2

0

Thanks guys, pointed me in the right direction in the end.

Just needed to escape the quotes in the img tag;

"q": "<img src=\"../images/q1.png\" />",
mickmaster
  • 15
  • 5
0

Yes sir this is a pretty simple fix. Just try adding this code below. It worked for me as well.

<img src=\"your.image.whatever\"/>