Highlighting Correct Response

andrew-robertson
andrew-robertson Community Member Posts: 196 ☆ Superstar ☆
edited November 12 in Lectora Desktop
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?
Andrew R.
Developing content since 2010 using a mixed bag of tools.

Best Answer

  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 598 eLearning ROCKSTAR Admin Team
    Accepted Answer
    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');


Answers

  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 598 eLearning ROCKSTAR Admin Team
    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.
  • andrew-robertson
    andrew-robertson Community Member Posts: 196 ☆ Superstar ☆
    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.
    Andrew R.
    Developing content since 2010 using a mixed bag of tools.
  • andrew-robertson
    andrew-robertson Community Member Posts: 196 ☆ Superstar ☆
    Sorry, I meant answer order ... not the question order.
    Andrew R.
    Developing content since 2010 using a mixed bag of tools.