diff --git a/templates/problem.js b/templates/problem.js index 4c4aa00d7a..65b91c01fd 100644 --- a/templates/problem.js +++ b/templates/problem.js @@ -51,7 +51,13 @@ function ${ id }_load() { $('#show_${ id }').click(function() { postJSON('/modx/problem/${ id }/problem_show', {}, function(data) { for (var key in data) { - $("#answer_"+key).text(data[key]); + if ($.isArray(data[key])){ + for (var ans_index in data[key]){ + var choice_id = 'input_'+key+'_'+data[key][ans_index]; + $("label[for="+choice_id+"]").attr("correct_answer", "true"); + } + } + $("#answer_"+key).text(data[key]); } });