Solved

Highlighting Correct Response

Hi there - a colleague and I are trying to figure out the best way to highlight an answer when the user submits their response.

She was able to figure out one method outlined below.

  1. Create an action (OnMClkRunJS) that is launched when the SUBMIT button is clicked.

  2. Add in the following JS code: document.getElementByID("text383272").style.fontWeight = "bold";

Now, this works fine and dandy but we need to get the individual text IDs for every question and having 60+ questions it can become tedious.

I am wondering if we could leverage the correct response variable from Lectora (basically however Lectora knows it is a correct/incorrect distractor).

Any thoughts?

Solution

If you would rather make the answer text bold an easier way might be to add a css class to the correct answer text block(s). Then you can have a JavaScript action that targets the css class.






triv$('.corrans span', getDisplayDocument()).css('fontWeight','bold');

Discussion (4)

One way I have seen authors do this is by adding an arrow, or arrows, initially hidden which point to the correct choice, and sometimes x's for incorrect answers. Then on submit they would would show the indicators. Then you wouldn't have to deal with getting object ids.

If you would rather make the answer text bold an easier way might be to add a css class to the correct answer text block(s). Then you can have a JavaScript action that targets the css class.






triv$('.corrans span', getDisplayDocument()).css('fontWeight','bold');

This is glorious! Thank you @wheels! The JQuery and CSS is perfect!

The problem with the arrows hidden/unhidden is that we randomize the question order so trying to tie the location of the arrows would be extremely difficult.

Sorry, I meant answer order ... not the question order.