Explore the community Forums Lectora Lectora Questions & Answers What is name of the "Correct Answer" to a scored test question? Reply To: What is name of the "Correct Answer" to a scored test question?

#366692 Score: 0
Profile photo of Darrel Somoza
Darrel Somoza
Member
contributor
friend finder
beginner
intermediate
junior moderator
advanced
wise owl
curious george
profile
209 pts
@Klaatu

Use Tim’s suggestion, it’s your best bet.

I do not want to write in the forum how Lectora goes about checking the answer because the code does something so that you cannot easily get the answer using the browsers developers tools.

What I can say is that if you already know the correct selection then you can check the Lectora question variable (ex. Question_0001) against the text of the correct selection. 😉

If the question was multiple choice and the correct selection was “Choice Two” then:

if(VarQuestion_0001.value == ‘Choice Two’)
{
$(‘span.text45Font1’).css({“color”:”green”,”font-weight”:”bolder”,”font-size”:”20px”,”text-shadow”:”2px 2px #FFFFFF”});
alert(“CORRECT”);
}
else if(VarQuestion_0001.value == ‘~~~null~~~’)
{
alert(‘You must first select an answer.’);
}
else
{
alert(‘WRONG’);
}

This will alter the style of the correct text in the question.
You could also check the answer against ‘~~~null~~~’ to be sure an answer was selected.

Basically, the only difference between doing this and what Lectora does internally is that the above will not register the answer with the program/LMS.

I hope I explained this sufficiently.